#print json.dumps(urls, indent=2) # Gather available images images = novaaccount.images(urls['nova'], account_info['authtoken']) # Print debugging print json.dumps(images, indent=2) # Gather available flavors flavors = novaaccount.flavors(urls['nova'], account_info['authtoken']) # Print debugging print json.dumps(flavors, indent=2) # Gather running servers servers = novaaccount.servers(urls['nova'], account_info['authtoken']) # Print debugging print json.dumps(servers, indent=2) # build the list of personalities to use, this will become parameters (maybe) post_install = {'path': '/opt/rpcs/post-install.sh', 'filename': 'post-install.sh'} personalities = novaservers.add_personalities([]) print json.dumps(personalities, indent=2) # Build the server(s) new_servers = novaservers.build_servers(account_info['authtoken'], urls['nova'], results.server_name, results.num_servers,
try: # Open the file fo = open("%s-build.json" % (results.username), "r") except IOError: print "Failed to open file %s-build.json" % (results.username) else: # Write the json string account_info = json.loads(fo.read()) #close the file fo.close() # print message for debugging print "%s-build.json successfully read into account_info" % (results.username) curr_servers = novaaccount.servers(account_info['urls']['nova'], account_info['authtoken']) # Loop through the new servers and the current runnins server to gather needed info to setup servers = {} for new_server in account_info['new_servers']: for curr_server in curr_servers: if new_server['server']['id'] in curr_servers[curr_server]['id']: name = curr_server admin_user = '******' admin_pass = new_server['server']['adminPass'] public_ip = curr_servers[curr_server]['public_ip'] private_ip = curr_servers[curr_server]['private_ip'] status = curr_servers[curr_server]['status'] key_name = new_server['server']['key_name'] servers[name] = {'user': admin_user, 'admin_pass': admin_pass,