Create a gist now

Instantly share code, notes, and snippets.

Get the status of a bare metal server that is in the process of being provisioned
import os
import pprint
import SoftLayer
client = SoftLayer.Client(username=os.environ['SLUSERNAME'], api_key=os.environ['SLAPIKEY'], endpoint_url=SoftLayer.API_PUBLIC_ENDPOINT)
# Call this repeatedly while the bare metal server is being provisioned, until provisionDate is filled in.
mask = 'mask[id,fullyQualifiedDomainName,provisionDate,hardwareStatus,lastTransaction[elapsedSeconds,transactionStatus[friendlyName]],operatingSystem[id,passwords[password,username]]]'
hostname = 'simplebmi'
domain = 'test.com'
filterStr = {"hardware":{"hostname":{"operation":hostname},"domain":{"operation":domain}}}
svrs = client['Account'].getHardware(mask=mask, filter=filterStr)
pprint.pprint(svrs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment