Fail execution if a role repo is a bare collection of roles

We generally expect a repo to either be a single bare role, or
to have a "roles/" directory which is a collection of roles.

We previously also supported the repo itself being a collection
of roles at the root of the repo, but that's not widely used
and is potentially confusing.  Especially since we want to make
a followup change to implicitly treat some repos as roles repos.

Stop supporting that for now.  If folks want to support this,
we might consider doing so only if there is a meta/main.ya?ml
file in the repo (as Galaxy accidentally supports that, though
it is not an explicit contract they guarantee).

Change-Id: Ie70e9fae4da57d4aefa01442a9f60526163b27c0
This commit is contained in:
James E. Blair 2017-07-10 14:27:29 -07:00
parent 6b537764f3
commit 053e7c8a73
1 changed files with 2 additions and 5 deletions

View File

@ -1079,11 +1079,8 @@ class AnsibleJob(object):
for entry in os.listdir(d):
self._blockPluginDirs(os.path.join(d, entry))
return d
# We assume the repository itself is a collection of roles
if not trusted:
for entry in os.listdir(path):
self._blockPluginDirs(os.path.join(path, entry))
return path
# It is neither a bare role, nor a collection of roles
raise Exception("Unable to find role in %s" % (path,))
def prepareZuulRole(self, args, role, root, trusted, untrusted):
self.log.debug("Prepare zuul role for %s" % (role,))