]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
calamari_nosetests: verify that calamari_branch exists
authorDan Mick <dan.mick@redhat.com>
Tue, 7 Jul 2015 02:28:11 +0000 (19:28 -0700)
committerDan Mick <dan.mick@redhat.com>
Tue, 7 Jul 2015 18:03:18 +0000 (11:03 -0700)
Fixes: #12206
Signed-off-by: Dan Mick <dan.mick@redhat.com>
tasks/calamari_nosetests.py

index 5c5b15dbecbb1f2f12246c1cb715154726020924..c6bbaf3630026f8d61c5cb923aac47f9c810782f 100644 (file)
@@ -4,6 +4,7 @@ import os
 import textwrap
 import yaml
 
+from cStringIO import StringIO
 from teuthology import contextutil
 from teuthology import misc
 from teuthology import packaging
@@ -113,10 +114,17 @@ def clone_calamari(config, client):
     branch = config.get('calamari_branch', 'master')
     url = config.get('calamari_giturl', 'git://github.com/ceph/calamari')
     try:
-        cmd = 'git clone -b {branch} {giturl}'.format(
-            branch=branch, giturl=url
+        out = StringIO()
+        # ensure branch is present (clone -b will succeed even if
+        # the branch doesn't exist, falling back to master)
+        client.run(
+            args='git ls-remote %s %s' % (url, branch),
+            stdout=out,
+            label='check for calamari branch %s existence' % branch
         )
-        client.run(args=cmd)
+        if len(out.getvalue()) == 0:
+            raise RuntimeError("Calamari branch %s doesn't exist" % branch)
+        client.run(args='git clone -b %s %s' % (branch, url))
         yield
     finally:
         # sudo python setup.py develop may have left some root files around