From cd32597af0e6316ab67da3da449c7eec6224e209 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sun, 17 Feb 2013 12:27:00 -0500 Subject: [PATCH] Make the file module work as expected in check mode --- lib/ansible/module_common.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_common.py b/lib/ansible/module_common.py index 310192de38..32767398f0 100644 --- a/lib/ansible/module_common.py +++ b/lib/ansible/module_common.py @@ -159,6 +159,7 @@ class AnsibleModule(object): if check_invalid_arguments: self._check_invalid_arguments() + self._check_for_check_mode() self._set_defaults(pre=True) @@ -462,13 +463,18 @@ class AnsibleModule(object): if alias in self.params: self.params[k] = self.params[alias] - def _check_invalid_arguments(self): + def _check_for_check_mode(self): for (k,v) in self.params.iteritems(): if k == 'CHECKMODE': if not self.supports_check_mode: self.exit_json(skipped=True, msg="remote module does not support check mode") if self.supports_check_mode: self.check_mode = True + + def _check_invalid_arguments(self): + for (k,v) in self.params.iteritems(): + if k == 'CHECKMODE': + continue if k not in self._legal_inputs: self.fail_json(msg="unsupported parameter for module: %s" % k)