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:
parent
25827c85d2
commit
91860b2423
1 changed files with 8 additions and 4 deletions
|
@ -83,8 +83,7 @@ class RoleRequirement(RoleDefinition):
|
||||||
# 'version': 'v1.0',
|
# 'version': 'v1.0',
|
||||||
# 'name': 'repo'
|
# 'name': 'repo'
|
||||||
# }
|
# }
|
||||||
|
display.deprecated("The comma separated role spec format, use the yaml/explicit format instead. Line that trigger this: %s" % role_spec)
|
||||||
display.deprecated("The comma separated role spec format, use the yaml/explicit format instead.")
|
|
||||||
|
|
||||||
default_role_versions = dict(git='master', hg='tip')
|
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)
|
return dict(name=name, src=src, scm=scm, version=version)
|
||||||
|
|
||||||
if 'role' in role:
|
if 'role' in role:
|
||||||
|
name = role['role']
|
||||||
|
if ',' in name:
|
||||||
# Old style: {role: "galaxy.role,version,name", other_vars: "here" }
|
# Old style: {role: "galaxy.role,version,name", other_vars: "here" }
|
||||||
role = RoleRequirement.role_spec_parse(role['role'])
|
role = RoleRequirement.role_spec_parse(role['role'])
|
||||||
|
else:
|
||||||
|
del role['role']
|
||||||
|
role['name'] = name
|
||||||
else:
|
else:
|
||||||
role = role.copy()
|
role = role.copy()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue