Merge pull request #513 from fgsch/fix_1904
Allow globbing in creates= and removes= directives
This commit is contained in:
commit
6288d44581
1 changed files with 5 additions and 4 deletions
|
@ -21,6 +21,7 @@
|
||||||
import copy
|
import copy
|
||||||
import sys
|
import sys
|
||||||
import datetime
|
import datetime
|
||||||
|
import glob
|
||||||
import traceback
|
import traceback
|
||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
|
@ -47,12 +48,12 @@ options:
|
||||||
aliases: []
|
aliases: []
|
||||||
creates:
|
creates:
|
||||||
description:
|
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
|
required: no
|
||||||
default: null
|
default: null
|
||||||
removes:
|
removes:
|
||||||
description:
|
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"
|
version_added: "0.8"
|
||||||
required: no
|
required: no
|
||||||
default: null
|
default: null
|
||||||
|
@ -188,7 +189,7 @@ def main():
|
||||||
# and the filename already exists. This allows idempotence
|
# and the filename already exists. This allows idempotence
|
||||||
# of command executions.
|
# of command executions.
|
||||||
v = os.path.expanduser(creates)
|
v = os.path.expanduser(creates)
|
||||||
if os.path.exists(v):
|
if glob.glob(v):
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
cmd=args,
|
cmd=args,
|
||||||
stdout="skipped, since %s exists" % v,
|
stdout="skipped, since %s exists" % v,
|
||||||
|
@ -202,7 +203,7 @@ def main():
|
||||||
# and the filename does not exist. This allows idempotence
|
# and the filename does not exist. This allows idempotence
|
||||||
# of command executions.
|
# of command executions.
|
||||||
v = os.path.expanduser(removes)
|
v = os.path.expanduser(removes)
|
||||||
if not os.path.exists(v):
|
if not glob.glob(v):
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
cmd=args,
|
cmd=args,
|
||||||
stdout="skipped, since %s does not exist" % v,
|
stdout="skipped, since %s does not exist" % v,
|
||||||
|
|
Loading…
Reference in a new issue