Forked from underscorephil/legacyEditPassword.py
Last active
December 21, 2015 05:29
-
-
Save sudorandom/6257453 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 = '' | |
passwordClient = SoftLayer.API.Client( | |
'SoftLayer_Software_Component_Password', None, apiUsername, apiKey) | |
def updatePassword(server): | |
passwordTemplate = { | |
'id': server['operatingSystem']['passwords'][0]['id'], | |
'softwareId': server['operatingSystem']['passwords'][0]['softwareId'], | |
'password': 'hello' | |
} | |
passwordClient.set_init_parameter(passwordTemplate['id']) | |
pp(passwordClient.editObject(passwordTemplate)) | |
accountClient = SoftLayer.API.Client( | |
'SoftLayer_Account', None, apiUsername, apiKey) | |
objectMask = "mask[operatingSystem.passwords]" | |
accountClient.set_object_mask(objectMask) | |
accountClient.softlayer | |
servers = accountClient.getHardware() | |
for server in servers: | |
updatePassword(server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment