Commit 88860428 authored by Christos Stavrakakis's avatar Christos Stavrakakis

ci: Add option to override schema

parent 2f457344
......@@ -25,7 +25,7 @@ CLEAN_CONFIG_CMDS = [CREATE_SERVER_CMD, ALL_CMDS]
USAGE = """usage: %%prog [options] command
command:
* %s Create the slave server
* %s: Create the slave server
* %s: Create debian packages for Synnefo in the created server
* %s: Deploy Synnefo in created server
* %s: Run Synnefo unittests
......@@ -54,6 +54,8 @@ def main():
action="store_true", default=False,
help="Download the debian packages that were created"
" during the '%s' step." % BUILD_SYNNEFO_CMD)
parser.add_option("--schema", dest="schema", default=None,
help="Schema for snf-deploy.")
(options, args) = parser.parse_args()
......@@ -91,7 +93,7 @@ def main():
if options.fetch_packages:
synnefo_ci.fetch_packages()
if getattr(options, DEPLOY_SYNNEFO_CMD, False):
synnefo_ci.deploy_synnefo()
synnefo_ci.deploy_synnefo(schema=options.schema)
if getattr(options, TEST_SYNNEFO_CMD, False):
synnefo_ci.unit_test()
if getattr(options, RUN_BURNIN_CMD, False):
......
......@@ -429,16 +429,20 @@ class SynnefoCI(object):
_run(cmd, False)
@_check_fabric
def deploy_synnefo(self):
def deploy_synnefo(self, schema=None):
"""Deploy Synnefo using snf-deploy"""
self.logger.info("Deploy Synnefo..")
schema = self.config.get('Global', 'schema')
schema_files = os.path.join(self.ci_dir, "schemas/%s/*" % schema)
if schema is None:
schema = self.config.get('Global', 'schema')
self.logger.debug("Will use %s schema" % schema)
schema_dir = os.path.join(self.ci_dir, "schemas/%s" % schema)
if not (os.path.exists(schema_dir) and os.path.isdir(schema_dir)):
raise ValueError("Unknown schema: %s" % schema)
self.logger.debug("Upload schema files to server")
with fabric.quiet():
fabric.put(schema_files, "/etc/snf-deploy/")
fabric.put(os.path.join(schema_dir, "*"), "/etc/snf-deploy/")
self.logger.debug("Change password in nodes.conf file")
cmd = """
......
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