summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormanas-init <70483021+manas-init@users.noreply.github.com>2021-02-25 00:52:24 +0100
committerGitHub <noreply@github.com>2021-02-25 00:52:24 +0100
commiteb72c36a71c8bf786d575a31246f602ad69cc9c9 (patch)
treec2efcb57955782fc4e8d1c86b81cedc39e5d9deb /lib
parentcommented function (#73625) (diff)
downloadansible-eb72c36a71c8bf786d575a31246f602ad69cc9c9.tar.xz
ansible-eb72c36a71c8bf786d575a31246f602ad69cc9c9.zip
galaxy: Handle ignored directory names in role skeleton (#72035)
* galaxy: restore left hand slicing in assignment Fix 'ansible-galaxy role init --role-skeleton=role-skeleton' when the role skeleton contains an ignored directory. The issue was because the 'dirs' variable was changed to reference a different list, but needs to be mutated instead to stop os.walk from traversing ignored directories. Fixes: #71977 Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/cli/galaxy.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py
index dedceced7e..d34544e37b 100644
--- a/lib/ansible/cli/galaxy.py
+++ b/lib/ansible/cli/galaxy.py
@@ -980,7 +980,9 @@ class GalaxyCLI(CLI):
else:
in_templates_dir = rel_root_dir == 'templates'
- dirs = [d for d in dirs if not any(r.match(d) for r in skeleton_ignore_re)]
+ # Filter out ignored directory names
+ # Use [:] to mutate the list os.walk uses
+ dirs[:] = [d for d in dirs if not any(r.match(d) for r in skeleton_ignore_re)]
for f in files:
filename, ext = os.path.splitext(f)