summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjjshoe <jjshoe@users.noreply.github.com>2014-04-18 21:39:10 -0500
committerJames Cammarata <jimi@sngx.net>2014-05-21 16:16:48 -0500
commitb01da1b780baaadaf7c22639bb32bcfc84077f01 (patch)
tree3650fe06bc45fe82bf1e0f746003a70c7ea41074
parent1248d2ce8a3f1b0626a0189cc468c5473e31b699 (diff)
downloadansible-b01da1b780baaadaf7c22639bb32bcfc84077f01.tar.gz
Ensure the validation string has %s in it
-rw-r--r--library/files/copy2
-rw-r--r--library/files/lineinfile2
-rw-r--r--library/files/replace2
3 files changed, 6 insertions, 0 deletions
diff --git a/library/files/copy b/library/files/copy
index 862a1ac77b..47012155f2 100644
--- a/library/files/copy
+++ b/library/files/copy
@@ -204,6 +204,8 @@ def main():
os.unlink(dest)
open(dest, 'w').close()
if validate:
+ if "%s" not in validate:
+ module.fail_json(msg="validate must contain %%s: %s" % (validate))
(rc,out,err) = module.run_command(validate % src)
if rc != 0:
module.fail_json(msg="failed to validate: rc:%s error:%s" % (rc,err))
diff --git a/library/files/lineinfile b/library/files/lineinfile
index 780764ad7b..ef629382f2 100644
--- a/library/files/lineinfile
+++ b/library/files/lineinfile
@@ -154,6 +154,8 @@ def write_changes(module,lines,dest):
validate = module.params.get('validate', None)
valid = not validate
if validate:
+ if "%s" not in validate:
+ module.fail_json(msg="validate must contain %%s: %s" % (validate))
(rc, out, err) = module.run_command(validate % tmpfile)
valid = rc == 0
if rc != 0:
diff --git a/library/files/replace b/library/files/replace
index f4193ae9f3..98a2a6a4d8 100644
--- a/library/files/replace
+++ b/library/files/replace
@@ -90,6 +90,8 @@ def write_changes(module,contents,dest):
validate = module.params.get('validate', None)
valid = not validate
if validate:
+ if "%s" not in validate:
+ module.fail_json(msg="validate must contain %%s: %s" % (validate))
(rc, out, err) = module.run_command(validate % tmpfile)
valid = rc == 0
if rc != 0: