Properly group check for branch in zuul functions

Not every zuul changeish has a branch. As a result we must check that
the object has a branch attribute before accessing it. The code
previously attempted to do this but due to precedence rules the binding
of the check was wrong and insufficient. Fix this with liberal use of
()s to make the precedence explicit and correct.

Change-Id: I06b3fd7ec4e5bdd14af3bc0bb1f7da39e238a879
This commit is contained in:
Clark Boylan 2014-06-24 17:09:33 -07:00
parent f8104050d4
commit 4d668437c2

View File

@ -43,8 +43,8 @@ def devstack_params(item, job, params):
# This is necessary to get the gearman plugin to register
# gearman jobs with both node labels.
if ((hasattr(change, 'branch') and
change.branch == 'stable/havana' or
change.branch == 'stable/icehouse') or
(change.branch == 'stable/havana' or
change.branch == 'stable/icehouse')) or
('havana' in job.name or
'icehouse' in job.name or
'precise' in job.name)):
@ -67,8 +67,8 @@ def default_params_trusty(item, job, params):
# This is necessary to get the gearman plugin to register
# gearman jobs with both node labels.
if ((hasattr(change, 'branch') and
change.branch == 'stable/havana' or
change.branch == 'stable/icehouse') or
(change.branch == 'stable/havana' or
change.branch == 'stable/icehouse')) or
('havana' in job.name or
'icehouse' in job.name or
'precise' in job.name)):