1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Verify that the role specification is using a comma before warning

One way to trigger this is having this snippet in meta/main.yml:

dependencies:
  - role: foo
    when: "use_foo == True"

It shouldn't show a warning but since we assume that 'foo' is the old
style format, it always show one. So we should verify the
style before calling role_spec_parse.
This commit is contained in:
Michael Scherer 2016-02-22 19:45:28 +01:00 committed by Brian Coca
parent 25827c85d2
commit 91860b2423

View file

@ -83,8 +83,7 @@ class RoleRequirement(RoleDefinition):
# 'version': 'v1.0',
# 'name': 'repo'
# }
display.deprecated("The comma separated role spec format, use the yaml/explicit format instead.")
display.deprecated("The comma separated role spec format, use the yaml/explicit format instead. Line that trigger this: %s" % role_spec)
default_role_versions = dict(git='master', hg='tip')
@ -145,8 +144,13 @@ class RoleRequirement(RoleDefinition):
return dict(name=name, src=src, scm=scm, version=version)
if 'role' in role:
# Old style: {role: "galaxy.role,version,name", other_vars: "here" }
role = RoleRequirement.role_spec_parse(role['role'])
name = role['role']
if ',' in name:
# Old style: {role: "galaxy.role,version,name", other_vars: "here" }
role = RoleRequirement.role_spec_parse(role['role'])
else:
del role['role']
role['name'] = name
else:
role = role.copy()