Skip to content

Commit

Permalink
Verify that the role specification is using a comma before warning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mscherer authored and bcoca committed Mar 7, 2017
1 parent 25827c8 commit 91860b2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/ansible/playbook/role/requirement.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ def role_spec_parse(role_spec):
# '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')

Expand Down Expand Up @@ -145,8 +144,13 @@ def role_yaml_parse(role):
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()

Expand Down

0 comments on commit 91860b2

Please sign in to comment.