Remove ansible-role from implied role names
In the case that we're using an implied role, strip 'ansible-' and 'role-' from the repo name when using it as the implied role name. If this doesn't work for any repos, they can always specify the role name explicitly. Change-Id: Ibf4b1852a811542de01f618fa3c5dcde3f57e27c
This commit is contained in:
parent
bb94dfa19a
commit
967b84d42b
|
@ -17,6 +17,7 @@ import os
|
|||
import logging
|
||||
import textwrap
|
||||
import io
|
||||
import re
|
||||
|
||||
import voluptuous as vs
|
||||
|
||||
|
@ -300,6 +301,8 @@ class SecretParser(object):
|
|||
|
||||
|
||||
class JobParser(object):
|
||||
ANSIBLE_ROLE_RE = re.compile(r'^(ansible[-_.+]*)*(role[-_.+]*)*')
|
||||
|
||||
@staticmethod
|
||||
def getSchema():
|
||||
auth = {'secrets': to_list(str),
|
||||
|
@ -563,6 +566,7 @@ class JobParser(object):
|
|||
def _makeImplicitRole(job):
|
||||
project = job.source_context.project
|
||||
name = project.name.split('/')[-1]
|
||||
name = JobParser.ANSIBLE_ROLE_RE.sub('', name)
|
||||
return model.ZuulRole(name,
|
||||
project.connection_name,
|
||||
project.name,
|
||||
|
|
Loading…
Reference in New Issue