Make roles ordered
The Ansible role path should be an ordered list as roles may have the same name and precedence is important. Change-Id: I1518789c8b3abea42873885a964ee05f3fe51c4f
This commit is contained in:
parent
c0b5ef33ba
commit
5fc8192df1
|
@ -467,7 +467,7 @@ class JobParser(object):
|
|||
r = JobParser._makeZuulRole(tenant, job, role)
|
||||
if r:
|
||||
roles.append(r)
|
||||
job.roles = job.roles.union(set(roles))
|
||||
job.addRoles(roles)
|
||||
|
||||
variables = conf.get('vars', None)
|
||||
if variables:
|
||||
|
|
|
@ -788,7 +788,7 @@ class Job(object):
|
|||
semaphore=None,
|
||||
attempts=3,
|
||||
final=False,
|
||||
roles=frozenset(),
|
||||
roles=(),
|
||||
required_projects={},
|
||||
allowed_projects=None,
|
||||
override_branch=None,
|
||||
|
@ -853,6 +853,13 @@ class Job(object):
|
|||
if not self.run:
|
||||
self.run = self.implied_run
|
||||
|
||||
def addRoles(self, roles):
|
||||
newroles = list(self.roles)
|
||||
for role in roles:
|
||||
if role not in newroles:
|
||||
newroles.append(role)
|
||||
self.roles = tuple(newroles)
|
||||
|
||||
def updateVariables(self, other_vars):
|
||||
v = self.variables
|
||||
Job._deepUpdate(v, other_vars)
|
||||
|
@ -928,7 +935,7 @@ class Job(object):
|
|||
if other._get('post_run') is not None:
|
||||
self.post_run = other.post_run + self.post_run
|
||||
if other._get('roles') is not None:
|
||||
self.roles = self.roles.union(other.roles)
|
||||
self.addRoles(other.roles)
|
||||
if other._get('variables') is not None:
|
||||
self.updateVariables(other.variables)
|
||||
if other._get('required_projects') is not None:
|
||||
|
|
Loading…
Reference in New Issue