mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07: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:
parent
8333a8b908
commit
156b29b26b
6 changed files with 237 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue