Commit b01da1b7 by jjshoe Committed by James Cammarata

Ensure the validation string has %s in it

parent 1248d2ce
...@@ -204,6 +204,8 @@ def main(): ...@@ -204,6 +204,8 @@ def main():
os.unlink(dest) os.unlink(dest)
open(dest, 'w').close() open(dest, 'w').close()
if 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 % src) (rc,out,err) = module.run_command(validate % src)
if rc != 0: if rc != 0:
module.fail_json(msg="failed to validate: rc:%s error:%s" % (rc,err)) module.fail_json(msg="failed to validate: rc:%s error:%s" % (rc,err))
......
...@@ -154,6 +154,8 @@ def write_changes(module,lines,dest): ...@@ -154,6 +154,8 @@ def write_changes(module,lines,dest):
validate = module.params.get('validate', None) validate = module.params.get('validate', None)
valid = not validate valid = not validate
if 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) (rc, out, err) = module.run_command(validate % tmpfile)
valid = rc == 0 valid = rc == 0
if rc != 0: if rc != 0:
......
...@@ -90,6 +90,8 @@ def write_changes(module,contents,dest): ...@@ -90,6 +90,8 @@ def write_changes(module,contents,dest):
validate = module.params.get('validate', None) validate = module.params.get('validate', None)
valid = not validate valid = not validate
if 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) (rc, out, err) = module.run_command(validate % tmpfile)
valid = rc == 0 valid = rc == 0
if rc != 0: if rc != 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment