diff --git a/lib/host.py b/lib/host.py index d7031a9bc..746fce6f9 100644 --- a/lib/host.py +++ b/lib/host.py @@ -201,13 +201,13 @@ def execute_script(self, script_contents, shebang='sh', simple_output=True): script.write('#!/usr/bin/env ' + shebang + '\n') script.write(script_contents) script.flush() - self.scp(script.name, script.name) + self.scp(script.name, "/tmp/" + os.path.basename(script.name)) try: logging.debug(f"[{self}] # Will execute this temporary script:\n{script_contents.strip()}") - return self.ssh([script.name], simple_output=simple_output) + return self.ssh(["/tmp/" + os.path.basename(script.name)], simple_output=simple_output) finally: - self.ssh(['rm', '-f', script.name]) + self.ssh(['rm', '-f', "/tmp/" + os.path.basename(script.name)]) def _get_xensource_inventory(self) -> Dict[str, str]: output = self.ssh(['cat', '/etc/xensource-inventory'])