summaryrefslogtreecommitdiff
path: root/commands/command.py
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2015-06-27 06:16:49 -0700
committerToshio Kuratomi <a.badger@gmail.com>2015-06-27 06:16:49 -0700
commit6288d44581e1d6eb5505d52ac692a9ef8f6b4918 (patch)
tree47976993d92cbe739ad63475c4848d5ba3234d9d /commands/command.py
parent2d3e93e55823d03891e1c6612e959ee785f17575 (diff)
parent9e381264ae599788f77a629ce3ffc7d24cf7c20a (diff)
downloadansible-modules-core-6288d44581e1d6eb5505d52ac692a9ef8f6b4918.tar.gz
Merge pull request #513 from fgsch/fix_1904
Allow globbing in creates= and removes= directives
Diffstat (limited to 'commands/command.py')
-rw-r--r--commands/command.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/commands/command.py b/commands/command.py
index b0aa5a7b..dbb23949 100644
--- a/commands/command.py
+++ b/commands/command.py
@@ -21,6 +21,7 @@
import copy
import sys
import datetime
+import glob
import traceback
import re
import shlex
@@ -47,12 +48,12 @@ options:
aliases: []
creates:
description:
- - a filename, when it already exists, this step will B(not) be run.
+ - a filename or glob pattern, when it already exists, this step will B(not) be run.
required: no
default: null
removes:
description:
- - a filename, when it does not exist, this step will B(not) be run.
+ - a filename or glob pattern, when it does not exist, this step will B(not) be run.
version_added: "0.8"
required: no
default: null
@@ -188,7 +189,7 @@ def main():
# and the filename already exists. This allows idempotence
# of command executions.
v = os.path.expanduser(creates)
- if os.path.exists(v):
+ if glob.glob(v):
module.exit_json(
cmd=args,
stdout="skipped, since %s exists" % v,
@@ -202,7 +203,7 @@ def main():
# and the filename does not exist. This allows idempotence
# of command executions.
v = os.path.expanduser(removes)
- if not os.path.exists(v):
+ if not glob.glob(v):
module.exit_json(
cmd=args,
stdout="skipped, since %s does not exist" % v,