Merge pull request #2842 from bcoca/cleanup
generalized cleanup and removed atomic_move return
This commit is contained in:
commit
cf26a425fa
1 changed files with 1 additions and 5 deletions
|
@ -147,11 +147,7 @@ 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: rc:%s error:%s" % (rc,err))
|
module.fail_json(msg="failed to validate: rc:%s error:%s" % (rc,err))
|
||||||
if not module.atomic_move(src, dest):
|
module.atomic_move(src, dest):
|
||||||
try:
|
|
||||||
os.unlink(src) # cleanup tmp files on failure
|
|
||||||
except OSError, e:
|
|
||||||
sys.stderr.write("failed to clean up tmp file %s: %s\n" % (src, e))
|
|
||||||
except IOError:
|
except IOError:
|
||||||
module.fail_json(msg="failed to copy: %s to %s" % (src, dest))
|
module.fail_json(msg="failed to copy: %s to %s" % (src, dest))
|
||||||
changed = True
|
changed = True
|
||||||
|
|
Loading…
Add table
Reference in a new issue