From: Dan Mick Date: Tue, 19 Jul 2016 21:12:24 +0000 (-0700) Subject: GitbuilderProject: fix/improve warning about multiple refs X-Git-Tag: 1.1.0~563^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b4942e04db7dfb6676303760c8411abbf12a58d7;p=teuthology.git GitbuilderProject: fix/improve warning about multiple refs 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 --- diff --git a/teuthology/packaging.py b/teuthology/packaging.py index a3aaba91b..8828999b3 100644 --- a/teuthology/packaging.py +++ b/teuthology/packaging.py @@ -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