Commit 126e0938 authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis Committed by Giorgos Korfiatis

snf-ci: Add 'shell' command

parent c0649302
......@@ -18,6 +18,7 @@ DEPLOY_SYNNEFO_CMD = "deploy"
TEST_SYNNEFO_CMD = "test"
RUN_BURNIN_CMD = "burnin"
CREATE_X2GO_FILE = "x2goplugin"
SHELL_CONNECT = "shell"
ALL_CMDS = "all"
COMMANDS_IN_ALL_MODE = [
......@@ -32,6 +33,7 @@ COMMANDS_IN_ALL_MODE = [
AVAILABLE_COMMANDS = [
CREATE_X2GO_FILE,
DELETE_SERVER_CMD,
SHELL_CONNECT,
] + COMMANDS_IN_ALL_MODE
USAGE = """usage: %%prog [options] command[,command...]
......@@ -45,6 +47,7 @@ command:
* %s: Run snf-burnin in the deployed Synnefo
* %s: Create x2go plugin file
* %s: Delete the slave server
* %s: Connect to the server using ssh
* %s: Run all the available commands
""" % tuple([CREATE_SERVER_CMD,
......@@ -55,10 +58,11 @@ command:
RUN_BURNIN_CMD,
CREATE_X2GO_FILE,
DELETE_SERVER_CMD,
SHELL_CONNECT,
ALL_CMDS])
def main(): # Too many branches. pylint: disable-msg=R0912
def main(): # pylint: disable=too-many-statements, too-many-branches
"""Parse command line options and run the specified actions"""
parser = OptionParser(usage=USAGE)
parser.add_option("-c", "--conf", dest="config_file", default=None,
......@@ -79,7 +83,7 @@ def main(): # Too many branches. pylint: disable-msg=R0912
help="Upload/Install the public ssh keys contained"
" in this file to the server")
parser.add_option("--name", dest="server_name", default=None,
help=""),
help="")
parser.add_option("-n", "--build-id", dest="build_id", default=None,
type="int",
help="Specify a number to use to identify this build."
......@@ -172,6 +176,8 @@ def main(): # Too many branches. pylint: disable-msg=R0912
synnefo_ci.x2go_plugin(options.x2go_output)
if getattr(options, DELETE_SERVER_CMD, False):
synnefo_ci.destroy_server()
if getattr(options, SHELL_CONNECT, False):
synnefo_ci.shell_connect()
if __name__ == "__main__":
......
......@@ -261,6 +261,12 @@ class SynnefoCI(object):
fip['floating_ip_address'])
self.network_client.delete_floatingip(fip['id'])
# pylint: disable= no-self-use
@_check_fabric
def shell_connect(self):
"""Open shell to remote server"""
fabric.open_shell("export TERM=xterm")
def _create_floating_ip(self):
"""Create a new floating ip"""
networks = self.network_client.list_networks(detail=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment