From 27978ed9c1b754dcec4dc5ca7d1defd4aaa45e09 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Thu, 14 Mar 2013 11:22:46 +0100 Subject: [PATCH 1/2] Don't override argument specs with FILE_COMMON_ARGUMENTS Doing so will remove aliases, types, etc, leading to #2388 and other issues. --- lib/ansible/module_common.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_common.py b/lib/ansible/module_common.py index 59b2f61fd1..f656fc0fb6 100644 --- a/lib/ansible/module_common.py +++ b/lib/ansible/module_common.py @@ -176,7 +176,9 @@ class AnsibleModule(object): self.aliases = {} if add_file_common_args: - self.argument_spec.update(FILE_COMMON_ARGUMENTS) + for k, v in FILE_COMMON_ARGUMENTS.iteritems(): + if k not in self.argument_spec: + self.argument_spec[k] = v os.environ['LANG'] = MODULE_LANG (self.params, self.args) = self._load_params() From fc227fbd37cc8e23a9f28da15a1459fd83b50a61 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Thu, 14 Mar 2013 11:27:49 +0100 Subject: [PATCH 2/2] Restore force in copy since arguments are no longer clobbered Fixes #2388. --- library/copy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/copy b/library/copy index f33f3910d5..d8d5410b8a 100644 --- a/library/copy +++ b/library/copy @@ -105,8 +105,8 @@ def main(): md5sum_dest = None if os.path.exists(dest): - # if not force: - # module.exit_json(msg="file already exists and force is set (%s)" % force, src=src, dest=dest, changed=False) + if not force: + module.exit_json(msg="file already exists", src=src, dest=dest, changed=False) if (os.path.isdir(dest)): basename = os.path.basename(src) dest = os.path.join(dest, basename)