From 81385a7d43ebe2551280f61c32c072d0354a23f3 Mon Sep 17 00:00:00 2001 From: Kevin Pouget Date: Thu, 9 Nov 2023 14:26:46 +0100 Subject: [PATCH] toolbox: _common: give a more unique name to the temp play files otherwise there might be conficts when running commands in parallel I'm not sure why NamedTemporaryFile doesn't give truly unique names, but I don't have time to investigate ... --- toolbox/_common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/toolbox/_common.py b/toolbox/_common.py index ec222c6481..ec846c09fc 100644 --- a/toolbox/_common.py +++ b/toolbox/_common.py @@ -171,7 +171,10 @@ def _run(self): print(f"Using '{env['ANSIBLE_JSON_TO_LOGFILE']}' as ansible json log file.") # the play file must be in the directory where the 'roles' are - tmp_play_file = tempfile.NamedTemporaryFile("w+", dir=os.getcwd(), delete=False) + tmp_play_file = tempfile.NamedTemporaryFile("w+", + prefix="tmp_play_{}_".format(artifact_extra_logs_dir.name), + suffix=".yaml", + dir=os.getcwd(), delete=False) generated_play = [ dict(name=f"Run {self.role_name} role", connection="local",