From b18455deca42486584bab2f0dd266e885d2c5e64 Mon Sep 17 00:00:00 2001 From: Fernando Flores Date: Thu, 3 Oct 2024 16:20:18 -0600 Subject: [PATCH] Added tmp_dir attribute definition to class --- plugins/action/zos_copy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/action/zos_copy.py b/plugins/action/zos_copy.py index 6d58faa11..ada6faec9 100644 --- a/plugins/action/zos_copy.py +++ b/plugins/action/zos_copy.py @@ -71,6 +71,8 @@ def run(self, tmp=None, task_vars=None): is_src_dir = False temp_path = is_uss = None + self.tmp_dir = None + if dest: if not isinstance(dest, string_types): msg = "Invalid type supplied for 'dest' option, it must be a string" @@ -268,8 +270,9 @@ def run(self, tmp=None, task_vars=None): if template_dir: shutil.rmtree(template_dir, ignore_errors=True) # Remove temporary directory from remote - path = os.path.normpath(f"{self.tmp_dir}/ansible-zos-copy") - self._connection.exec_command(f"rm -rf {path}*") + if self.tmp_dir is not None: + path = os.path.normpath(f"{self.tmp_dir}/ansible-zos-copy") + self._connection.exec_command(f"rm -rf {path}*") if copy_res.get("note") and not force: result["note"] = copy_res.get("note")