From: Loic Dachary Date: Wed, 2 Dec 2015 14:06:26 +0000 (+0100) Subject: openstack: allow override of openstack:clone: X-Git-Tag: 1.1.0~643^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F797%2Fhead;p=teuthology.git 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 --- diff --git a/scripts/openstack.py b/scripts/openstack.py index 1f258b3c9..b467de4f5 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 b69420512..3746de24b 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 0317fc072..107103d0e 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