Exemplo n.º 1
0
def start_match(match):
    serverid = servers.find_open_server()
    if serverid == None:
        return None
    #move the server and start it
    scode = servers.edit_server(serverid, {'location':match.location})
    if scode != 200:
        return None
    scode = servers.start_server(serverid)
    if scode != 200:
        return None
    #tell the server to request the match config from CGL
    scode = servers.put_console(serverid, "get5_loadmatch_url \"https://cgl-discord-bot.herokuapp.com/config/%s\"" % match.id)
    if scode != 200:
        return None
    return servers.server_info(serverid)[0]
Exemplo n.º 2
0
#!/usr/bin/env python
from servers import start_server, start_clients, shell
from settings import NUM_CLIENTS

server = start_server()
clients = start_clients(NUM_CLIENTS)

open("test_client/server.ip", "w").write(server.public_ip[0])
open("server.ip", "w").write(server.public_ip[0])
open("clients.ip", "w").write("\n".join(c.public_ip[0] for c in clients))

shell('rsync -qazr test_server root@%s:/www/services' % server.public_ip[0])
for client in clients:
    shell('rsync -qazr test_client root@%s:/root' % client.public_ip[0])

print "Done."
Exemplo n.º 3
0
    def run(self):

        # Add sec_group rule
        floating_ip.create_delete_security_group(self)

        # Keypair processing

        keypairs.list_keypair(self)
        keypairs.create_keypair(self)
        keypairs.delete_keypair(self)

        # Flavor processing
        flavors.list_flavors(self)
        flavors.get_flavor(self)

        # Create server
        images.select_image(self)
        keypairs.select_keypair(self)
        networks.select_network(self)

        servers.create_instance(self)
        servers.check_active(self)

        # floating IP
        floating_ip.create_floating(self)
        sleep(10)
        floating_ip.add_floating(self)

        # SSH to Instance
        if self.ssh_to_instance == "True":
            floating_ip.ssh_to_instance(self)

        # Stop server
        servers.get_server(self)
        servers.stop_server(self)
        servers.check_stopped(self)

        # Start stopped server
        servers.get_server(self)
        servers.start_server(self)
        servers.check_active(self)

        # Reboot server Hard
        servers.reboot_server_hard(self)
        servers.check_active(self)

        # Set and delete server metadata
        servers.set_server_metadata(self)
        servers.delete_server_metadata(self)

        # Delete floating ip
        floating_ip.delete_floating(self)

        # Delete instance
        servers.delete_instance(self)

        sleep(5)

        if self.overall_success is True:
            exit(0)
        else:
            exit(1)
Exemplo n.º 4
0
 async def start(self, ctx, servername):
     scode = servers.start_server(servers.server_id(servername))
     if scode == 200:
         await ctx.send("Server started.")
     else:
         await ctx.send("Failed to start server.")