Don't copy a file from a skeleton if file.j2 also exists (PR#82624)

* fixed a bug in the if condition that made it essentially a noop
* added PR reference to changelog fragment
pull/82624/head
Markus Falb 4 months ago
parent c1f592107d
commit 0428490e3c

@ -0,0 +1,7 @@
---
minor_changes:
- >-
If a collection-skeleton is used with ansible-galaxy collection init
or role init and both a file and file.j2 are present, only copy file.j2
(https://github.com/ansible/ansible/pull/82624)
...

@ -1,9 +0,0 @@
---
minor_changes:
- >
If a collection-skeleton is used with ansible-galaxy collection init
and both a file and file.j2 are present, only copy file.j2
- >
If a role-skeleton is used with ansible-galaxy role init
and both a file and file.j2 are present, only copy file.j2
...

@ -1218,7 +1218,7 @@ class GalaxyCLI(CLI):
with open(dest_file, 'wb') as df:
df.write(b_rendered)
else:
if os.path.join(f, '.j2') in files:
if f + '.j2' in files:
# We have two possible sources for the same file, we prefer the jinja template
continue
f_rel_path = os.path.relpath(os.path.join(root, f), obj_skeleton)

Loading…
Cancel
Save