Skip to content

Instantly share code, notes, and snippets.

@bmpotter
Last active August 29, 2015 14:27
Show Gist options
  • Save bmpotter/0249e838dce1370a7aa0 to your computer and use it in GitHub Desktop.
Save bmpotter/0249e838dce1370a7aa0 to your computer and use it in GitHub Desktop.
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