logsetting.init() client = Client(COMPASS_SERVER_URL) _login(client,COMPASS_USER_EMAIL,COMPASS_USER_PASSWORD) status, resp = client.list_hosts() #print '\r\nget all hosts status: %s resp\r\n' % (status) #print json.dumps(resp,indent=2) if status >= 400: msg = 'failed to get subnets' raise Exception(msg) host_mapping = {} for host in resp: host_mapping[host['hostname']] = host['id'] print '\r\nget hostmapping: %s \r\n' % (host_mapping) status, resp = client.list_clusters() #print '\r\nget all cluster status: %s resp: \r\n' % (status) #print json.dumps(resp,indent=2) if status >= 400: msg = 'failed to get subnets' raise Exception(msg) cluster_id = resp[0]['id'] print '\r\n_get_cluster_host_status:%s\r\n' %cluster_id _get_cluster_host_status(client, cluster_id, host_mapping)