From 91b6004149bee6aed7b326f420bcfe1aa5f82c6c Mon Sep 17 00:00:00 2001 From: Will Thames Date: Wed, 4 Nov 2015 15:31:11 +1000 Subject: [PATCH] Allow blank lines and comments/spaces in galaxy spec files Fixes #10641 again. (Regression) Added test to discourage future such regression. --- lib/ansible/cli/galaxy.py | 2 ++ test/integration/galaxy_rolesfile | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py index d8b0cee70a1..c32e3e49f78 100644 --- a/lib/ansible/cli/galaxy.py +++ b/lib/ansible/cli/galaxy.py @@ -328,6 +328,8 @@ class GalaxyCLI(CLI): self.display.deprecated("going forward only the yaml format will be supported") # roles listed in a file, one per line for rline in f.readlines(): + if rline.startswith("#") or rline.strip() == '': + continue self.display.debug('found role %s in text file' % str(rline)) role = RoleRequirement.role_yaml_parse(rline.strip()) roles_left.append(GalaxyRole(self.galaxy, **role)) diff --git a/test/integration/galaxy_rolesfile b/test/integration/galaxy_rolesfile index 0caf1c25336..b78cdc11481 100644 --- a/test/integration/galaxy_rolesfile +++ b/test/integration/galaxy_rolesfile @@ -1,4 +1,8 @@ +# deliberate non-empty whitespace line to follow + + 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 +# comment git+git@github.com:geerlingguy/ansible-role-php.git