Also show stdout when validation fails. This fixes #2498

This commit is contained in:
Bert Van Vreckem 2015-12-08 12:55:09 +01:00
parent 15dcabe012
commit 9556bcb9c2

View file

@ -279,7 +279,7 @@ def main():
# os.path.exists() can return false in some # os.path.exists() can return false in some
# circumstances where the directory does not have # circumstances where the directory does not have
# the execute bit for the current user set, in # the execute bit for the current user set, in
# which case the stat() call will raise an OSError # which case the stat() call will raise an OSError
os.stat(os.path.dirname(dest)) os.stat(os.path.dirname(dest))
except OSError, e: except OSError, e:
if "permission denied" in str(e).lower(): if "permission denied" in str(e).lower():
@ -308,7 +308,7 @@ def main():
module.fail_json(msg="validate must contain %%s: %s" % (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", exit_status=rc, stdout=out, stderr=err)
if remote_src: if remote_src:
_, tmpdest = tempfile.mkstemp(dir=os.path.dirname(dest)) _, tmpdest = tempfile.mkstemp(dir=os.path.dirname(dest))
shutil.copy2(src, tmpdest) shutil.copy2(src, tmpdest)