]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
GitbuilderProject: fix/improve warning about multiple refs 913/head
authorDan Mick <dan.mick@redhat.com>
Tue, 19 Jul 2016 21:12:24 +0000 (14:12 -0700)
committerDan Mick <dan.mick@redhat.com>
Tue, 26 Jul 2016 17:45:00 +0000 (10:45 -0700)
warn() tries to warn you when you overspecify a commit (by
giving more than one of ref, tag, branch, or sha1).

1) fix it to actually work (it was always warning)
2) Improve the warning to indicate not only which is taking
precedence but what was supplied for the others.

Signed-off-by: Dan Mick <dan.mick@redhat.com>
teuthology/packaging.py

index a3aaba91b2c32867f8bf2ae09c3c5c021dd43db7..8828999b31c2184864a024cf0722c25aa11ed3fd 100644 (file)
@@ -656,11 +656,16 @@ class GitbuilderProject(object):
             sha1 = self.sha1
 
         def warn(attrname):
-            if len([b for b in ref, tag, branch, sha1]) > 1:
+            names = ('ref', 'tag', 'branch', 'sha1')
+            vars = (ref, tag, branch, sha1)
+            # filter(None,) filters for truth
+            if len(filter(None, vars)) > 1:
                 log.warning(
                     'More than one of ref, tag, branch, or sha1 supplied; using %s',
                      attrname
                 )
+                for n, v in zip(names, vars):
+                    log.info('%s: %s' % (n, v))
 
         if ref:
             uri = 'ref'/ + ref