Commit ebef27e4 authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis

snf-ci: Add command line option for repo/branch

This patch adds two new command line options to snf-ci:

* --synnefo-repo: Allows the user to specify the Synnefo repository
* --synnefo-branch: Allows the user to specify the Synnefo branch
parent bd29216a
......@@ -73,6 +73,10 @@ def main(): # pylint: disable=too-many-statements, too-many-branches
" script (Default: %s)" % DEFAULT_CONFIG_FILE)
parser.add_option("--cloud", dest="kamaki_cloud", default=None,
help="Use specified cloud, as is in .kamakirc")
parser.add_option("--synnefo-repo", dest="synnefo_repo", default=None,
help="Specify the synnefo repo to use")
parser.add_option("--synnefo-branch", dest="synnefo_branch", default=None,
help="Specify the synnefo branch to use")
parser.add_option("-f", "--flavor", dest="flavor", default=None,
help="Flavor to use for the server."
" Supports both search by name (reg expression)"
......@@ -165,7 +169,10 @@ def main(): # pylint: disable=too-many-statements, too-many-branches
image=options.image,
ssh_keys=options.ssh_keys,
server_name=options.server_name)
synnefo_ci.clone_repo(local_repo=options.local_repo)
synnefo_ci.clone_repo(
synnefo_repo=options.synnefo_repo,
synnefo_branch=options.synnefo_branch,
local_repo=options.local_repo)
if getattr(options, BUILD_SYNNEFO_CMD, False):
synnefo_ci.build_packages()
if options.fetch_packages:
......
......@@ -640,7 +640,8 @@ class SynnefoCI(object):
sys.exit(1)
@_check_fabric
def clone_repo(self, local_repo=False):
def clone_repo(self, synnefo_repo=None,
synnefo_branch=None, local_repo=False):
"""Clone Synnefo repo from slave server"""
self.logger.info("Configure repositories on remote server..")
self.logger.debug("Install/Setup git")
......@@ -653,16 +654,21 @@ class SynnefoCI(object):
_run(cmd, False)
# Clone synnefo_repo
synnefo_branch = self.clone_synnefo_repo(local_repo=local_repo)
synnefo_branch = self.clone_synnefo_repo(
synnefo_repo=synnefo_repo, synnefo_branch=synnefo_branch,
local_repo=local_repo)
# Clone pithos-web-client
self.clone_pithos_webclient_repo(synnefo_branch)
@_check_fabric
def clone_synnefo_repo(self, local_repo=False):
def clone_synnefo_repo(self, synnefo_repo=None,
synnefo_branch=None, local_repo=False):
"""Clone Synnefo repo to remote server"""
# Find synnefo_repo and synnefo_branch to use
synnefo_repo = self.config.get('Global', 'synnefo_repo')
synnefo_branch = self.config.get("Global", "synnefo_branch")
if synnefo_repo is None:
synnefo_repo = self.config.get('Global', 'synnefo_repo')
if synnefo_branch is None:
synnefo_branch = self.config.get("Global", "synnefo_branch")
if synnefo_branch == "":
synnefo_branch = \
subprocess.Popen(
......
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