Commit dcc48f24 by James Cammarata

Use atomic_move to put the file, rather than shelling out

Fixes #4321

Conflicts:
	library/utilities/accelerate
parent 191ce5e1
......@@ -380,14 +380,7 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
if final_path:
vvv("moving %s to %s" % (out_path, final_path))
args = ['sudo','cp',out_path,final_path]
rc, stdout, stderr = self.server.module.run_command(args, close_fds=True)
if rc != 0:
return dict(failed=True, stdout="failed to copy the file into position with sudo")
args = ['sudo','chown',final_user,out_path,final_path]
rc, stdout, stderr = self.server.module.run_command(args, close_fds=True)
if rc != 0:
return dict(failed=True, stdout="failed to chown the file via sudo")
self.server.module.atomic_move(out_path, final_path)
return dict()
def daemonize(module, password, port, timeout, minutes):
......
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