From 6848fc3da7fc2e0cf023b7a37c9fcc2469157a76 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Wed, 2 Dec 2015 15:06:26 +0100 Subject: [PATCH] openstack: allow override of openstack:clone: When running from a wip teuthology branch, it is inconvenient to tweak ~/.teuthology.yaml. Add --teuthology-git-url and --teuthology-branch to take precendence and override the defaults. Signed-off-by: Loic Dachary --- scripts/openstack.py | 9 +++++++++ teuthology/openstack/__init__.py | 6 ++++++ teuthology/openstack/test/test_openstack.py | 6 ++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/scripts/openstack.py b/scripts/openstack.py index 1f258b3c94..b467de4f50 100644 --- a/scripts/openstack.py +++ b/scripts/openstack.py @@ -61,6 +61,15 @@ and analyze results. action='store_true', default=None, help='destroy the cluster, if it exists', ) + parser.add_argument( + '--teuthology-git-url', + help=("git clone url for teuthology"), + ) + parser.add_argument( + '--teuthology-branch', + help="use this teuthology branch instead of master", + default='master', + ) parser.add_argument( '--upload', action='store_true', default=False, diff --git a/teuthology/openstack/__init__.py b/teuthology/openstack/__init__.py index b694205126..3746de24b5 100644 --- a/teuthology/openstack/__init__.py +++ b/teuthology/openstack/__init__.py @@ -478,6 +478,8 @@ class TeuthologyOpenStack(OpenStack): argv = [] while len(original_argv) > 0: if original_argv[0] in ('--name', + '--teuthology-branch', + '--teuthology-git-url', '--archive-upload', '--archive-upload-url', '--key-name', @@ -646,6 +648,10 @@ ssh access : ssh {identity}{username}@{ip} # logs in /usr/share/nginx/ else: upload = '' clone = teuth_config.openstack['clone'] + if self.args.teuthology_git_url: + clone = ("git clone -b {branch} {url}".format( + branch=self.args.teuthology_branch, + url=self.args.teuthology_git_url)) log.debug("OPENRC = " + openrc + " " + "TEUTHOLOGY_USERNAME = " + self.username + " " + "CLONE_OPENSTACK = " + clone + " " + diff --git a/teuthology/openstack/test/test_openstack.py b/teuthology/openstack/test/test_openstack.py index 0317fc0725..107103d0ec 100644 --- a/teuthology/openstack/test/test_openstack.py +++ b/teuthology/openstack/test/test_openstack.py @@ -338,7 +338,9 @@ openstack keypair delete {key_name} || true ] archive_upload = 'user@archive:/tmp' argv = (self.options + - ['--upload', + ['--teuthology-git-url', 'TEUTHOLOGY_URL', + '--teuthology-branch', 'TEUTHOLOGY_BRANCH', + '--upload', '--archive-upload', archive_upload] + teuthology_argv) args = scripts.openstack.parse_args(argv) @@ -358,7 +360,7 @@ openstack keypair delete {key_name} || true assert "nworkers=" + str(args.simultaneous_jobs) in l assert "username=" + teuthology.username in l assert "upload=--archive-upload user@archive:/tmp" in l - assert "clone=git clone" in l + assert "clone=git clone -b TEUTHOLOGY_BRANCH TEUTHOLOGY_URL" in l assert os.environ['OS_AUTH_URL'] in l assert " ".join(teuthology_argv) in l -- 2.39.5