mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
* Fix file module check_mode
This commit is contained in:
parent
e9dbebfa57
commit
22a6927dbd
2 changed files with 10 additions and 2 deletions
|
@ -322,6 +322,9 @@ def execute_touch(path, follow):
|
|||
b_path = to_bytes(path, errors='surrogate_or_strict')
|
||||
prev_state = get_state(b_path)
|
||||
|
||||
# Unfortunately, touch always changes the file because it updates file's timestamp
|
||||
result = {'dest': path, 'changed': True}
|
||||
|
||||
if not module.check_mode:
|
||||
if prev_state == 'absent':
|
||||
# Create an empty file if the filename did not already exist
|
||||
|
@ -369,8 +372,8 @@ def execute_touch(path, follow):
|
|||
os.remove(b_path)
|
||||
raise
|
||||
|
||||
# Unfortunately, touch always changes the file because it updates file's timestamp
|
||||
return {'dest': path, 'changed': True, 'diff': diff}
|
||||
result['diff'] = diff
|
||||
return result
|
||||
|
||||
|
||||
def ensure_file_attributes(path, follow):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue