mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Fix for check_mode in archive (#26788)
Fix adds check_mode fix for archive module. Also, adds unit tests for archive module Fixes: #26750 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
committed by
jctanner
parent
8333a8b908
commit
156b29b26b
@@ -327,7 +327,7 @@ def main():
|
||||
module.fail_json(dest=dest, msg='Error deleting some source files: ' + str(e), files=errors)
|
||||
|
||||
# Rudimentary check: If size changed then file changed. Not perfect, but easy.
|
||||
if os.path.getsize(dest) != size:
|
||||
if not check_mode and os.path.getsize(dest) != size:
|
||||
changed = True
|
||||
|
||||
if len(successes) and state != 'incomplete':
|
||||
@@ -405,7 +405,8 @@ def main():
|
||||
params['path'] = dest
|
||||
file_args = module.load_file_common_arguments(params)
|
||||
|
||||
changed = module.set_fs_attributes_if_different(file_args, changed)
|
||||
if not check_mode:
|
||||
changed = module.set_fs_attributes_if_different(file_args, changed)
|
||||
|
||||
module.exit_json(archived=successes, dest=dest, changed=changed, state=state, arcroot=arcroot, missing=missing, expanded_paths=expanded_paths)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user