#!/usr/bin/env python from rightscale import RightScale import sys rsapi = RightScale(ACCOUNTID, USERNAME, PASSWORD) myself = rsapi.whoami() if myself is None: print >>sys.stderr, "This system is not found in RightScale." exit(1) # Find all servers (including myself) in my deployment. servers = [s for s in rsapi.servers if s.deployment_href == myself.deployment_href] tagged = dict() for server in servers: #print server #print server.tags for tag in server.tags: #print tag tagged.setdefault(tag.name, list()) tagged[tag.name].append(server) data = dict() data["deployment"] = myself.deployment.nickname data["name"] = myself.nickname data["servers"] = dict() for server in servers:
def test_empty_api_endpoint(): rs = RightScale(refresh_token='not empty', api_endpoint='') rs.login()
def test_health_check(): api = RightScale() print "API health is %s" % api.health_check()
def test_bogus_refresh_token(): rs = RightScale(refresh_token='bogus') rs.login()