|
|
@ -321,12 +321,11 @@ def main():
|
|
|
|
(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", exit_status=rc, stdout=out, stderr=err)
|
|
|
|
module.fail_json(msg="failed to validate", exit_status=rc, stdout=out, stderr=err)
|
|
|
|
|
|
|
|
mysrc = src
|
|
|
|
if remote_src:
|
|
|
|
if remote_src:
|
|
|
|
_, tmpdest = tempfile.mkstemp(dir=os.path.dirname(dest))
|
|
|
|
_, mysrc = tempfile.mkstemp(dir=os.path.dirname(dest))
|
|
|
|
shutil.copy2(src, tmpdest)
|
|
|
|
shutil.copy2(src, mysrc)
|
|
|
|
module.atomic_move(tmpdest, dest)
|
|
|
|
module.atomic_move(mysrc, dest, unsafe_writes=module.params['unsafe_writes'])
|
|
|
|
else:
|
|
|
|
|
|
|
|
module.atomic_move(src, dest)
|
|
|
|
|
|
|
|
except IOError:
|
|
|
|
except IOError:
|
|
|
|
module.fail_json(msg="failed to copy: %s to %s" % (src, dest), traceback=traceback.format_exc())
|
|
|
|
module.fail_json(msg="failed to copy: %s to %s" % (src, dest), traceback=traceback.format_exc())
|
|
|
|
changed = True
|
|
|
|
changed = True
|
|
|
|