diff options
-rw-r--r-- | network/basics/get_url.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/network/basics/get_url.py b/network/basics/get_url.py index b0d27859..d2155256 100644 --- a/network/basics/get_url.py +++ b/network/basics/get_url.py @@ -192,7 +192,6 @@ def extract_filename_from_headers(headers): # main def main(): - argument_spec = url_argument_spec() argument_spec.update( url = dict(required=True), @@ -219,7 +218,15 @@ def main(): if not dest_is_dir and os.path.exists(dest): if not force: - module.exit_json(msg="file already exists", dest=dest, url=url, changed=False) + # allow file attribute changes + module.params['path'] = dest + file_args = module.load_file_common_arguments(module.params) + file_args['path'] = dest + changed = module.set_fs_attributes_if_different(file_args, False) + + if changed: + module.exit_json(msg="file already exists but file attributes changed", dest=dest, url=url, changed=changed) + module.exit_json(msg="file already exists", dest=dest, url=url, changed=changed) # If the file already exists, prepare the last modified time for the # request. |