Last active
December 14, 2015 00:29
-
-
Save underscorephil/4999589 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SoftLayer.API | |
from pprint import pprint as pp | |
apiUsername = '' | |
apiKey = '' | |
client = SoftLayer.Client(username=apiUsername, api_key=apiKey) | |
def updatePassword(server): | |
passwordTemplate = { | |
'id': server['operatingSystem']['passwords'][0]['id'], | |
'softwareId': server['operatingSystem']['passwords'][0]['softwareId'], | |
'password': 'hello' | |
} | |
pp(client['Software_Component_Password'].editObject( | |
passwordTemplate, id=passwordTemplate['id'])) | |
servers = client['Account'].getHardware(mask='mask[operatingSystem.passwords]') | |
for server in servers: | |
updatePassword(server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment