mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 23:21:22 -07:00
Enforce state='file'
in copy
module
This was causing wrong behaviour when `prev_state` was `hard`-link, since the `file` module tried to apply the same `state` on the new file, causing unexpected errors. Particularly, both `overlay` and `devicemapper` storage drivers in docker use hardlinks to share files between layers. This causes most ansible playbooks to fail when working with files from layers below.
This commit is contained in:
parent
78dfbed2a5
commit
ecfa7f696d
3 changed files with 43 additions and 1 deletions
|
@ -250,6 +250,7 @@ def main():
|
|||
if basename:
|
||||
params['path'] = path = os.path.join(path, basename)
|
||||
b_path = to_bytes(path, errors='surrogate_or_strict')
|
||||
prev_state = get_state(b_path)
|
||||
|
||||
# make sure the target path is a directory when we're doing a recursive operation
|
||||
if recurse and state != 'directory':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue