Commit 833e1f6e by Stephen Fromm

Make sure action plugin copy cleans up tmp dir

The copy action plugin creates its own tmp dir for each file that it
copies to the target machine.  However, it does not clean up the
original tmp path it was given when run() is called.  This cleans up the
tmp path before it begins looping on source files.
parent 0d4294da
...@@ -125,6 +125,9 @@ class ActionModule(object): ...@@ -125,6 +125,9 @@ class ActionModule(object):
changed = False changed = False
diffs = [] diffs = []
module_result = {"changed": False} module_result = {"changed": False}
# Remove tmp path since a new one is created below. Should be empty.
if tmp.find("tmp") != -1:
self.runner._low_level_exec_command(conn, "rm -rf %s > /dev/null 2>&1" % tmp, tmp)
for source_full, source_rel in source_files: for source_full, source_rel in source_files:
# We need to get a new tmp path for each file, otherwise the copy module deletes the folder. # We need to get a new tmp path for each file, otherwise the copy module deletes the folder.
tmp = self.runner._make_tmp_path(conn) tmp = self.runner._make_tmp_path(conn)
......
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