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.
pull/21933/head
Michael Scherer 9 years ago committed by Brian Coca
parent 25827c85d2
commit 91860b2423

@ -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()

Loading…
Cancel
Save