From b4942e04db7dfb6676303760c8411abbf12a58d7 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Tue, 19 Jul 2016 14:12:24 -0700 Subject: [PATCH] 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 --- teuthology/packaging.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/teuthology/packaging.py b/teuthology/packaging.py index a3aaba91b2..8828999b31 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 -- 2.39.5