Commit bbcdb21b authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis
Browse files

ci: Add an x2goplugin command to snf-ci

With this command snf-ci produces an html file
which uses the x2goplugin to connect to the remote
machine.
parent 4584bf63
......@@ -25,6 +25,8 @@ git_config_mail = synnefo@builder.dev.grnet.gr
accept_ssh_from =
# Config file to save temporary options (eg IPs, passwords etc)
temporary_config = /tmp/ci_temp_conf
# File to save the x2goplugin html file
x2go_plugin_file = /tmp/x2go.html
[Deployment]
......
......@@ -16,9 +16,10 @@ BUILD_DOCS_SYNNEFO_CMD = "docs"
DEPLOY_SYNNEFO_CMD = "deploy"
TEST_SYNNEFO_CMD = "test"
RUN_BURNIN_CMD = "burnin"
CREATE_X2GO_FILE = "x2goplugin"
ALL_CMDS = "all"
AVAILABLE_COMMANDS = [
COMMANDS_IN_ALL_MODE = [
CREATE_SERVER_CMD,
BUILD_SYNNEFO_CMD,
BUILD_DOCS_SYNNEFO_CMD,
......@@ -27,6 +28,10 @@ AVAILABLE_COMMANDS = [
RUN_BURNIN_CMD,
]
AVAILABLE_COMMANDS = [
CREATE_X2GO_FILE,
] + COMMANDS_IN_ALL_MODE
USAGE = """usage: %%prog [options] command[,command...]
command:
......@@ -36,6 +41,7 @@ command:
* %s: Deploy Synnefo in created server
* %s: Run Synnefo unittests
* %s: Run snf-burnin in the deployed Synnefo
* %s: Create x2go plugin file
* %s: Run all the available commands
""" % tuple([CREATE_SERVER_CMD,
......@@ -44,6 +50,7 @@ command:
DEPLOY_SYNNEFO_CMD,
TEST_SYNNEFO_CMD,
RUN_BURNIN_CMD,
CREATE_X2GO_FILE,
ALL_CMDS])
......@@ -90,6 +97,8 @@ def main(): # Too many branches. pylint: disable-msg=R0912
action="store_true",
help="Instead of cloning from the official Synnefo"
" repo, copy and use the local one.")
parser.add_option("--x2go-output", dest="x2go_output", default=None,
help="File where to save the x2go plugin html page.")
(options, args) = parser.parse_args()
......@@ -102,7 +111,7 @@ def main(): # Too many branches. pylint: disable-msg=R0912
commands = args[0]
if commands == ALL_CMDS:
for cmd in AVAILABLE_COMMANDS:
for cmd in COMMANDS_IN_ALL_MODE:
setattr(options, cmd, True)
else:
......@@ -142,6 +151,8 @@ def main(): # Too many branches. pylint: disable-msg=R0912
synnefo_ci.unit_test()
if getattr(options, RUN_BURNIN_CMD, False):
synnefo_ci.run_burnin()
if getattr(options, CREATE_X2GO_FILE, False):
synnefo_ci.x2go_plugin(options.x2go_output)
if __name__ == "__main__":
......
......@@ -790,6 +790,53 @@ class SynnefoCI(object):
self.logger.info("Downloaded debian packages to %s" %
_green(dest))
def x2go_plugin(self, dest=None):
"""Produce an html page which will use the x2goplugin
Arguments:
dest -- The file where to save the page (String)
"""
output_str = """
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>X2Go SynnefoCI Service</title>
</head>
<body onload="checkPlugin()">
<div id="x2goplugin">
<object
src="location"
type="application/x2go"
name="x2goplugin"
palette="background"
height="100%"
hspace="0"
vspace="0"
width="100%"
x2goconfig="
session=X2Go-SynnefoCI-Session
server={0}
user={1}
sshport={2}
published=true
autologin=true
">
</object>
</div>
</body>
</html>
""".format(self.read_temp_config('server_ip'),
self.read_temp_config('server_user'),
self.read_temp_config('server_port'))
if dest is None:
dest = self.config.get('Global', 'x2go_plugin_file')
self.logger.info("Writting x2go plugin html file to %s" % dest)
fid = open(dest, 'w')
fid.write(output_str)
fid.close()
def parse_typed_option(option, value):
"""Parsed typed options (flavors and images)"""
......
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