Skip to content

Instantly share code, notes, and snippets.

@underscorephil
Last active August 16, 2016 12:08
Show Gist options
  • Save underscorephil/4999540 to your computer and use it in GitHub Desktop.
Save underscorephil/4999540 to your computer and use it in GitHub Desktop.
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)
@ylwdream
Copy link

i want to update the softlayer device passwd, can this code work now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment