From 002972c6cffd3c8a0b97714f324b6ee73167d4c5 Mon Sep 17 00:00:00 2001 From: Will Thames Date: Thu, 22 Oct 2015 13:25:58 +1000 Subject: [PATCH] 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. --- lib/ansible/playbook/role/include.py | 3 +++ test/integration/galaxy_roles.yml | 2 +- test/integration/galaxy_rolesfile | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/playbook/role/include.py b/lib/ansible/playbook/role/include.py index fd8e4e5d99..f2cf9ec5b6 100644 --- a/lib/ansible/playbook/role/include.py +++ b/lib/ansible/playbook/role/include.py @@ -27,6 +27,7 @@ from ansible.errors import AnsibleError, AnsibleParserError from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject from ansible.playbook.attribute import Attribute, FieldAttribute from ansible.playbook.role.definition import RoleDefinition +from ansible.playbook.role.requirement import RoleRequirement __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): 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) return ri.load_data(data, variable_manager=variable_manager, loader=loader) diff --git a/test/integration/galaxy_roles.yml b/test/integration/galaxy_roles.yml index 5a1f8eba86..5f4373c500 100644 --- a/test/integration/galaxy_roles.yml +++ b/test/integration/galaxy_roles.yml @@ -3,7 +3,7 @@ name: oracle_java7 - src: git+http://bitbucket.org/willthames/git-ansible-galaxy - version: v1.4 + version: v1.6 - src: http://bitbucket.org/willthames/hg-ansible-galaxy scm: hg diff --git a/test/integration/galaxy_rolesfile b/test/integration/galaxy_rolesfile index 00be59b103..0caf1c2533 100644 --- a/test/integration/galaxy_rolesfile +++ b/test/integration/galaxy_rolesfile @@ -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 https://bitbucket.org/willthames/http-ansible-galaxy/get/master.tar.gz,,http-role git+git@github.com:geerlingguy/ansible-role-php.git