diff options
author | Marco Capitani <m.capitani@nextworks.it> | 2018-04-24 12:51:01 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-05-03 11:11:42 +0000 |
commit | 846f0a7eb5e6a7e47731247aa58686475dcde9b2 (patch) | |
tree | d34771a09f788cc47cdd5f3076b28551f8d5dd2c | |
parent | af69f30d6580b220f858878a5ca1d2357def365a (diff) | |
download | rumba-846f0a7eb5e6a7e47731247aa58686475dcde9b2.tar.gz rumba-846f0a7eb5e6a7e47731247aa58686475dcde9b2.zip |
fix for ssh not taking root into account
-rw-r--r-- | rumba/executors/ssh.py | 15 |
1 files 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) |