Skip to content

Commit

Permalink
toolbox: _common: give a more unique name to the temp play files
Browse files Browse the repository at this point in the history
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 ...
  • Loading branch information
kpouget committed Nov 9, 2023
1 parent 1fc0d18 commit 81385a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion toolbox/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 81385a7

Please sign in to comment.