Skip to content

Instantly share code, notes, and snippets.

@barakm
Last active August 29, 2015 14:15
Show Gist options
  • Save barakm/3233e79d7200c50f7e7d to your computer and use it in GitHub Desktop.
Save barakm/3233e79d7200c50f7e7d to your computer and use it in GitHub Desktop.
mist.io HP Cloud setup
from mistclient import MistClient
client = MistClient(email="MY_MIST_EMAIL", password="MY_MIST_PASSWORD")
hp_username="HP_CLOUD_USERNAME"
hp_password="HP_CLOUD_PASSWORD"
hp_regions = [
["hpcloud:region-a.geo-1", "HP - US West"],
["hpcloud:region-b.geo-1", "HP - US East"]
]
# list of HP tenants to monitor
hp_tenants = ["my-first-tenant", "my-other-tenant"]
def create_hp_backends():
for region, region_name in hp_regions:
for tenant in hp_tenants:
print "Creating HP backend for tenant %s in region %s" % (tenant, region)
try:
client.add_backend(title= "%s - %s" % (region_name, tenant), provider=region, key=hp_username,secret=hp_password,tenant_name=tenant)
except Exception as e:
print "Failed to create backend: %s" % e.message
create_hp_backends()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment