From 85a31616dea5437005172d8a6cea81b969d5c556 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Tue, 2 Oct 2012 22:12:30 -0400 Subject: [PATCH] Call os.path.expanduser in the creates= and removes= section of the command module so ~/ and the like works. --- library/command | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/command b/library/command index 6ae3dc2d32..8d2702d219 100755 --- a/library/command +++ b/library/command @@ -145,6 +145,7 @@ class CommandModule(AnsibleModule): # do not run the command if the line contains creates=filename # and the filename already exists. This allows idempotence # of command executions. + v = os.path.expanduser(v) if os.path.exists(v): self.exit_json( cmd=args, @@ -158,10 +159,11 @@ class CommandModule(AnsibleModule): # do not run the command if the line contains removes=filename # and the filename do not exists. This allows idempotence # of command executions. + v = os.path.expanduser(v) if not os.path.exists(v): self.exit_json( cmd=args, - stdout="skipped, since %s do not exists" % v, + stdout="skipped, since %s does not exist" % v, skipped=True, changed=False, stderr=False,