Skip to content

Instantly share code, notes, and snippets.

@underscorephil
Last active December 14, 2015 00:29
Show Gist options
  • Save underscorephil/4999589 to your computer and use it in GitHub Desktop.
Save underscorephil/4999589 to your computer and use it in GitHub Desktop.
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