示例#1
0
adapter_ids = []
for adapter in resp['adapters']:
    adapter_ids.append(adapter['id'])

adapter_id = adapter_ids[0]
print 'adpater for deploying a cluster: %s' % adapter_id

# add a cluster.
status, resp = client.add_cluster(cluster_name=CLUSTER_NAME,
                                  adapter_id=adapter_id)
print 'add cluster %s status: %s, resp: %s' % (CLUSTER_NAME, status, resp)
cluster = resp['cluster']
cluster_id = cluster['id']

# add hosts to the cluster.
status, resp = client.add_hosts(cluster_id=cluster_id,
                                machine_ids=machines.keys())
print 'add hosts to cluster %s status: %s, resp: %s' % (cluster_id, status,
                                                        resp)
host_ids = []
for host in resp['cluster_hosts']:
    host_ids.append(host['id'])

print 'added hosts: %s' % host_ids

# set cluster security
status, resp = client.set_security(cluster_id,
                                   server_username=SERVER_USERNAME,
                                   server_password=SERVER_PASSWORD,
                                   service_username=SERVICE_USERNAME,
                                   service_password=SERVICE_PASSWORD,
                                   console_username=CONSOLE_USERNAME,
示例#2
0
    adapter_ids.append(adapter['id'])

adapter_id = adapter_ids[0]
print 'adpater for deploying a cluster: %s' % adapter_id


# add a cluster.
status, resp = client.add_cluster(
    cluster_name=CLUSTER_NAME, adapter_id=adapter_id)
print 'add cluster %s status: %s, resp: %s' % (CLUSTER_NAME, status, resp)
cluster = resp['cluster']
cluster_id = cluster['id']

# add hosts to the cluster.
status, resp = client.add_hosts(
    cluster_id=cluster_id,
    machine_ids=machines.keys())
print 'add hosts to cluster %s status: %s, resp: %s' % (
    cluster_id, status, resp)
host_ids = []
for host in resp['cluster_hosts']:
    host_ids.append(host['id'])

print 'added hosts: %s' % host_ids


# set cluster security
status, resp = client.set_security(
    cluster_id, server_username=SERVER_USERNAME,
    server_password=SERVER_PASSWORD,
    service_username=SERVICE_USERNAME,