From 1bc08323bff43971f0836fc9deb8d0cc99dbd9dd Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 4 May 2018 01:50:48 +0100 Subject: [PATCH] ansible: more compatible module script naming. --- ansible_mitogen/runner.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ansible_mitogen/runner.py b/ansible_mitogen/runner.py index 323a0c1a..b0738d37 100644 --- a/ansible_mitogen/runner.py +++ b/ansible_mitogen/runner.py @@ -175,7 +175,7 @@ class TemporaryEnvironment(object): class TemporaryArgv(object): def __init__(self, argv): self.original = sys.argv[:] - sys.argv[:] = argv + sys.argv[:] = map(str, argv) def revert(self): sys.argv[:] = self.original @@ -219,10 +219,9 @@ class ProgramRunner(Runner): Create a temporary file containing the program code. The code is fetched via :meth:`_get_program`. """ - self.program_fp = open( - os.path.join(self.get_temp_dir(), self.module), - 'wb' - ) + name = 'ansible_module_' + os.path.basename(self.path) + path = os.path.join(self.get_temp_dir(), name) + self.program_fp = open(path, 'wb') self.program_fp.write(self._get_program()) self.program_fp.flush() os.chmod(self.program_fp.name, int('0700', 8))