]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Can now run specific ceph version based on sha1.
authorTommi Virtanen <tommi.virtanen@dreamhost.com>
Fri, 10 Jun 2011 00:05:55 +0000 (17:05 -0700)
committerTommi Virtanen <tommi.virtanen@dreamhost.com>
Fri, 10 Jun 2011 00:17:47 +0000 (17:17 -0700)
teuthology/misc.py
teuthology/task/ceph.py

index 6bed0014a15207458517b3883bc26252f818ef52..e68b3a0e606e172deb99aaccd8cae57c379f79e2 100644 (file)
@@ -9,16 +9,26 @@ import urlparse
 
 log = logging.getLogger(__name__)
 
-def get_ceph_binary_url(branch=None, tag=None, flavor=None):
-    # gitbuilder uses remote-style ref names for branches, mangled to
-    # have underscores instead of slashes; e.g. origin_master
-    if tag is not None:
-        ref = tag
-        assert branch is None, "cannot set both branch and tag"
+def get_ceph_binary_url(branch=None, tag=None, sha1=None, flavor=None):
+    if sha1 is not None:
+        assert branch is None, "cannot set both sha1 and branch"
+        assert tag is None, "cannot set both sha1 and tag"
     else:
-        if branch is None:
-            branch = 'master'
-        ref = 'origin_{branch}'.format(branch=branch)
+        # gitbuilder uses remote-style ref names for branches, mangled to
+        # have underscores instead of slashes; e.g. origin_master
+        if tag is not None:
+            ref = tag
+            assert branch is None, "cannot set both branch and tag"
+        else:
+            if branch is None:
+                branch = 'master'
+            ref = 'origin_{branch}'.format(branch=branch)
+
+        sha1_url = urlparse.urljoin(BASE, 'ref/{ref}/sha1'.format(ref=ref))
+        log.debug('Translating ref to sha1 using url %s', sha1_url)
+        sha1_fp = urllib2.urlopen(sha1_url)
+        sha1 = sha1_fp.read().rstrip('\n')
+        sha1_fp.close()
 
     if flavor is None:
         flavor = ''
@@ -31,11 +41,7 @@ def get_ceph_binary_url(branch=None, tag=None, flavor=None):
         # of them. hoping for yagni.
         flavor = '-{flavor}-amd64'.format(flavor=flavor)
     BASE = 'http://ceph.newdream.net/gitbuilder{flavor}/output/'.format(flavor=flavor)
-    sha1_url = urlparse.urljoin(BASE, 'ref/{ref}/sha1'.format(ref=ref))
-    log.debug('Translating ref to sha1 using url %s', sha1_url)
-    sha1_fp = urllib2.urlopen(sha1_url)
-    sha1 = sha1_fp.read().rstrip('\n')
-    sha1_fp.close()
+
     log.debug('Using ceph sha1 %s', sha1)
     bindir_url = urlparse.urljoin(BASE, 'sha1/{sha1}/'.format(sha1=sha1))
     return (sha1, bindir_url)
index d503723ab4c4cccbbbdef27fe7c69e168592eaab..b09124666bd1403cf05ad82e31d2071fe9ec632c 100644 (file)
@@ -35,6 +35,12 @@ def task(ctx, config):
         - ceph:
             tag: v0.42.13
 
+    Or a sha1::
+
+        tasks:
+        - ceph:
+            sha1: 1376a5ab0c89780eab39ffbbe436f6a6092314ed
+
     To capture code coverage data, use::
 
         tasks:
@@ -112,6 +118,7 @@ def task(ctx, config):
     sha1, ceph_bindir_url = teuthology.get_ceph_binary_url(
         branch=config.get('branch'),
         tag=config.get('tag'),
+        sha1=config.get('sha1'),
         flavor=flavor,
         )
     ctx.cluster.run(