From 846f0a7eb5e6a7e47731247aa58686475dcde9b2 Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Tue, 24 Apr 2018 12:51:01 +0200 Subject: fix for ssh not taking root into account --- rumba/executors/ssh.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/rumba/executors/ssh.py b/rumba/executors/ssh.py index c47358f..6876204 100644 --- a/rumba/executors/ssh.py +++ b/rumba/executors/ssh.py @@ -36,18 +36,13 @@ class SSHExecutor(Executor): self.use_proxy = use_proxy def execute_command(self, node, command, as_root=False, time_out=3): + return self.execute_commands(node, [command], as_root, time_out) + + def execute_commands(self, node, commands, as_root=False, time_out=3): if as_root: if node.ssh_config.username != 'root': - command = "sudo %s" % command - - if self.use_proxy: - return execute_proxy_command(self, node.ssh_config, command, - time_out) - else: - return execute_command(self.testbed, node.ssh_config, command, - time_out) + commands = list(map(lambda c: "sudo %s" % (c,), commands)) - def execute_commands(self, node, commands, as_root=False, time_out=3): if self.use_proxy: return execute_proxy_commands(self, node.ssh_config, commands, time_out) @@ -55,7 +50,7 @@ class SSHExecutor(Executor): return execute_commands(self.testbed, node.ssh_config, commands, time_out) - def fetch_file(self, node, path, destination, sudo): + def fetch_file(self, node, path, destination, sudo=False): copy_file_from_testbed(self.testbed, node.ssh_config, path, destination, sudo) -- cgit v1.2.3