diff --git a/files/copy b/files/copy index 08aa1d71a40..42ce49c5f1e 100644 --- a/files/copy +++ b/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/files/lineinfile b/files/lineinfile index f781911ccd1..2e8a29cda38 100644 --- a/files/lineinfile +++ b/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/files/replace b/files/replace index f4193ae9f30..98a2a6a4d88 100644 --- a/files/replace +++ b/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: