Merge pull request #1000 from mavimo/patch-1

Add support to removes control param
pull/1006/merge
Michael DeHaan 12 years ago
commit 4280e00d56

@ -114,6 +114,21 @@ class CommandModule(AnsibleModule):
rc=0 rc=0
) )
args = args.replace(x,'') args = args.replace(x,'')
elif x.startswith("removes="):
# do not run the command if the line contains removes=filename
# and the filename do not exists. This allows idempotence
# of command executions.
(k,v) = x.split("=",1)
if not os.path.exists(v):
self.exit_json(
cmd=args,
stdout="skipped, since %s do not exists" % v,
skipped=True,
changed=False,
stderr=False,
rc=0
)
args = args.replace(x,'')
elif x.startswith("chdir="): elif x.startswith("chdir="):
(k,v) = x.split("=", 1) (k,v) = x.split("=", 1)
v = os.path.expanduser(v) v = os.path.expanduser(v)

Loading…
Cancel
Save