Ensure the validation string has %s in it

This commit is contained in:
jjshoe 2014-04-18 21:39:10 -05:00 committed by Joel Schuweiler
parent c5e9a06c2a
commit a34478d6f3
3 changed files with 6 additions and 0 deletions

View file

@ -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))

View file

@ -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:

View file

@ -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: