mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
now ANSIBLE_KEEP_REMOTE_FILE acts as boolean
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
This commit is contained in:
@@ -329,7 +329,7 @@ class Runner(object):
|
||||
cmd = " ".join([environment_string.strip(), shebang.replace("#!","").strip(), cmd])
|
||||
cmd = cmd.strip()
|
||||
|
||||
if tmp.find("tmp") != -1 and C.DEFAULT_KEEP_REMOTE_FILES != '1' and not persist_files:
|
||||
if tmp.find("tmp") != -1 and not C.DEFAULT_KEEP_REMOTE_FILES and not persist_files:
|
||||
if not self.sudo or self.sudo_user == 'root':
|
||||
# not sudoing or sudoing to root, so can cleanup files in the same step
|
||||
cmd = cmd + "; rm -rf %s >/dev/null 2>&1" % tmp
|
||||
@@ -338,7 +338,7 @@ class Runner(object):
|
||||
if self.sudo and self.sudo_user != 'root':
|
||||
# not sudoing to root, so maybe can't delete files as that other user
|
||||
# have to clean up temp files as original user in a second step
|
||||
if tmp.find("tmp") != -1 and C.DEFAULT_KEEP_REMOTE_FILES != '1' and not persist_files:
|
||||
if tmp.find("tmp") != -1 and not C.DEFAULT_KEEP_REMOTE_FILES and not persist_files:
|
||||
cmd2 = "rm -rf %s >/dev/null 2>&1" % tmp
|
||||
self._low_level_exec_command(conn, cmd2, tmp, sudoable=False)
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class ActionModule(object):
|
||||
result = handler.run(conn, tmp, 'raw', module_args, inject)
|
||||
|
||||
# clean up after
|
||||
if tmp.find("tmp") != -1 and C.DEFAULT_KEEP_REMOTE_FILES != '1':
|
||||
if tmp.find("tmp") != -1 and not C.DEFAULT_KEEP_REMOTE_FILES:
|
||||
self.runner._low_level_exec_command(conn, 'rm -rf %s >/dev/null 2>&1' % tmp, tmp)
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user