From 30dbd8b5493480d2c302380735083c2d9b8f8260 Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Thu, 1 Jun 2017 16:43:03 +0200 Subject: model: added proxy field. ssh: added execute_proxy_commands --- rumba/model.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'rumba/model.py') diff --git a/rumba/model.py b/rumba/model.py index 285d937..27fcc23 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -38,11 +38,19 @@ logger = log.get_logger(__name__) # @exp_name [string] experiment name # class Testbed: - def __init__(self, exp_name, username, password, proj_name): + def __init__(self, + exp_name, + username, + password, + proj_name, + http_proxy=None): self.username = username self.password = password self.proj_name = proj_name self.exp_name = exp_name + if http_proxy is None: + http_proxy = "" + self.http_proxy = http_proxy @abc.abstractmethod def swap_in(self, experiment): -- cgit v1.2.3 From c92408dc0a74e2ca1ef47cc721ad41dff614aaa4 Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Thu, 1 Jun 2017 17:34:53 +0200 Subject: Model: corrected no-proxy case. rlite: removed hardcoded proxy --- rumba/model.py | 2 -- rumba/prototypes/rlite.py | 10 +++++++--- rumba/ssh_support.py | 9 ++++++--- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'rumba/model.py') diff --git a/rumba/model.py b/rumba/model.py index 27fcc23..6508c86 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -48,8 +48,6 @@ class Testbed: self.password = password self.proj_name = proj_name self.exp_name = exp_name - if http_proxy is None: - http_proxy = "" self.http_proxy = http_proxy @abc.abstractmethod diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index 625668d..de2ba52 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -38,6 +38,10 @@ class Experiment(mod.Experiment): ssh.execute_commands(self.testbed, node.ssh_config, cmds, time_out=None) + def execute_proxy_commands(self, node, cmds): + ssh.execute_proxy_commands(self.testbed, node.ssh_config, + cmds, time_out=None) + # Prepend sudo to all commands if the user is not 'root' def may_sudo(self, cmds): if self.testbed.username != 'root': @@ -117,17 +121,17 @@ class Experiment(mod.Experiment): def install_prototype(self): logger.info("installing rlite on all nodes") cmds = ["sudo apt-get update", - "export https_proxy=\"https://proxy.atlantis.ugent.be:8080\"; sudo -E apt-get install g++ gcc cmake " + "sudo -E apt-get install g++ gcc cmake " "linux-headers-$(uname -r) " "protobuf-compiler libprotobuf-dev git --yes", "rm -rf ~/rlite", - "cd ~; export https_proxy=\"https://proxy.atlantis.ugent.be:8080\"; git clone https://github.com/vmaffione/rlite", + "cd ~; git clone https://github.com/vmaffione/rlite", "cd ~/rlite && ./configure && make && sudo make install", "cd ~/rlite && sudo make depmod" ] for node in self.nodes: - self.execute_commands(node, cmds) + self.execute_proxy_commands(node, cmds) logger.info("installation complete") def bootstrap_prototype(self): diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py index 93a48f8..f8ba03b 100644 --- a/rumba/ssh_support.py +++ b/rumba/ssh_support.py @@ -59,9 +59,12 @@ def execute_proxy_commands(testbed, ssh_config, commands, time_out=3): new_commands = [] for command in commands: proxy = testbed.http_proxy - proxy_command = 'export http_proxy=' + proxy + '; ' \ - + 'export https_proxy=' + proxy + ';' - new_commands.append(proxy_command + ' ' + command) + if proxy is not None: + proxy_command = 'export http_proxy=' + proxy + '; ' \ + + 'export https_proxy=' + proxy + ';' + new_commands.append(proxy_command + ' ' + command) + else: + new_commands.append(command) return execute_commands(testbed, ssh_config, new_commands, time_out) -- cgit v1.2.3