From b5cb3321d4175e71869c1f178a894781c33cf39b Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sun, 20 Mar 2016 07:34:59 -0700 Subject: If file attribs are specified set them even if file already exists. Fixes #11821 --- network/basics/get_url.py | 11 +++++++++-- 1 file 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. -- cgit v1.2.1