Allow meta/main.yml to include roles through spec file

ansible-playbook now works when run with a playbook
that includes a role that includes another role
specified using csv format

Updated one of the roles used in the tests to fix
broken tests - `make test_galaxy` now works

Fixes #11486. Also addresses the problem alluded to in #10620.
pull/12861/head
Will Thames 9 years ago
parent 2b3c5aa41e
commit 002972c6cf

@ -27,6 +27,7 @@ from ansible.errors import AnsibleError, AnsibleParserError
from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject
from ansible.playbook.attribute import Attribute, FieldAttribute from ansible.playbook.attribute import Attribute, FieldAttribute
from ansible.playbook.role.definition import RoleDefinition from ansible.playbook.role.definition import RoleDefinition
from ansible.playbook.role.requirement import RoleRequirement
__all__ = ['RoleInclude'] __all__ = ['RoleInclude']
@ -47,6 +48,8 @@ class RoleInclude(RoleDefinition):
def load(data, play, current_role_path=None, parent_role=None, variable_manager=None, loader=None): def load(data, play, current_role_path=None, parent_role=None, variable_manager=None, loader=None):
assert isinstance(data, string_types) or isinstance(data, dict) or isinstance(data, AnsibleBaseYAMLObject) assert isinstance(data, string_types) or isinstance(data, dict) or isinstance(data, AnsibleBaseYAMLObject)
if isinstance(data, string_types) and ',' in data:
data = RoleRequirement.role_spec_parse(data)
ri = RoleInclude(play=play, role_basedir=current_role_path, variable_manager=variable_manager, loader=loader) ri = RoleInclude(play=play, role_basedir=current_role_path, variable_manager=variable_manager, loader=loader)
return ri.load_data(data, variable_manager=variable_manager, loader=loader) return ri.load_data(data, variable_manager=variable_manager, loader=loader)

@ -3,7 +3,7 @@
name: oracle_java7 name: oracle_java7
- src: git+http://bitbucket.org/willthames/git-ansible-galaxy - src: git+http://bitbucket.org/willthames/git-ansible-galaxy
version: v1.4 version: v1.6
- src: http://bitbucket.org/willthames/hg-ansible-galaxy - src: http://bitbucket.org/willthames/hg-ansible-galaxy
scm: hg scm: hg

@ -1,4 +1,4 @@
git+https://bitbucket.org/willthames/git-ansible-galaxy,v1.4 git+https://bitbucket.org/willthames/git-ansible-galaxy,v1.6
hg+https://bitbucket.org/willthames/hg-ansible-galaxy hg+https://bitbucket.org/willthames/hg-ansible-galaxy
https://bitbucket.org/willthames/http-ansible-galaxy/get/master.tar.gz,,http-role https://bitbucket.org/willthames/http-ansible-galaxy/get/master.tar.gz,,http-role
git+git@github.com:geerlingguy/ansible-role-php.git git+git@github.com:geerlingguy/ansible-role-php.git

Loading…
Cancel
Save