Exemplo n.º 1
0
	os.chdir(workspace_dir)
	# Run git command to print current commit hash
	subprocess.call(['git', 'log', '-1'])
except OSError:
	print "No Such Directory : %s" % (workspace_dir)

# Run Things
print "!!## -- Start Tearing Down Virtualized Infrastructure -- ##!!"

# gather account info
account_info = cloudaccount.generate_account_info(results.username, results.apikey)

# Create a dict of the URLS for the API for the account
urls = cloudaccount.urls(account_info['catalogs'])

## Gather the current servers
servers = cloudaccount.servers(urls[results.dc], account_info['authtoken'])

to_delete_servers = []
for server in servers:
	if results.server_name in server:
		to_delete_servers.append(servers[server]['id'])

# Run delete servers
deleted_servers = cloudservers.delete_servers(account_info['authtoken'], urls[results.dc], to_delete_servers)

# Print the result of delete_servers
print "The results of delete servers : "
print deleted_servers

print "!!## -- Finished Tearing Down Virtualized Infrastructure -- ##!!"
Exemplo n.º 2
0
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 = cloudaccount.servers(account_info['urls']['dfw'], 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']
			servers[name] = {'user' : admin_user,
					  		 'admin_pass' : admin_pass,
					  		 'public_ip' : public_ip,