diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-11-15 10:27:58 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-11-15 10:55:14 +0100 |
commit | 88e18d3e30d67681b0f6cf4a55c731255daa650b (patch) | |
tree | 08b688a40b36181533f74f80435e8318dd0ba70e | |
parent | a10232a5bd0db41733d0d8562e2fe56008f01cec (diff) | |
download | rumba-88e18d3e30d67681b0f6cf4a55c731255daa650b.tar.gz rumba-88e18d3e30d67681b0f6cf4a55c731255daa650b.zip |
prototypes: Use common aptitude install function
This lets the prototypes use a common function to install packages
through aptitude.
-rw-r--r-- | rumba/prototypes/irati.py | 15 | ||||
-rw-r--r-- | rumba/prototypes/ouroboros.py | 15 | ||||
-rw-r--r-- | rumba/prototypes/rlite.py | 14 | ||||
-rw-r--r-- | rumba/ssh_support.py | 28 |
4 files changed, 49 insertions, 23 deletions
diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index 32b1353..6a0b0f5 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -81,19 +81,18 @@ class Experiment(mod.Experiment): def install(self): """Installs IRATI on the nodes.""" - cmds = [self.sudo("while fuser /var/lib/dpkg/lock > /dev/null 2>&1 " + - "do sleep 1; echo \"Waiting for dpkg...\"; done"), - self.sudo("apt-get update"), - self.sudo("apt-get install g++ gcc libtool " - "linux-headers-$(uname -r) autoconf automake " - "protobuf-compiler libprotobuf-dev " - "git pkg-config libssl-dev --yes"), - self.sudo("rm -rf ~/stack"), + + packages = ["g++", "gcc", "libtool", "linux-headers-$(uname -r)", + "autoconf", "automake", "protobuf-compiler", + "libprotobuf-dev", "git", "pkg-config", "libssl-dev"] + + cmds = [self.sudo("rm -rf ~/stack"), "cd ~; git clone -b arcfire https://github.com/IRATI/stack", "cd ~/stack && " + self.sudo("./configure && ") + self.sudo("make install")] for node in self.nodes: + ssh.aptitude_install(self.testbed, node, packages) ssh.execute_proxy_commands(self.testbed, node.ssh_config, cmds, time_out=None) diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index 716f1b8..7bbeaca 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -47,17 +47,16 @@ class Experiment(mod.Experiment): time_out=None) def install_ouroboros(self): - cmds = list() + packages = ["cmake", "protobuf-c-compiler", "git", "libfuse-dev", + "libgcrypt20-dev", "libssl-dev"] - cmds.append("sudo apt-get update") - cmds.append("sudo apt-get install cmake protobuf-c-compiler " + - "git libfuse-dev libgcrypt20-dev libssl-dev --yes") - cmds.append("sudo apt-get install libprotobuf-c-dev --yes || true") - cmds.append("sudo rm -r ~/ouroboros || true") - cmds.append("git clone -b be git://ouroboros.ilabt.imec.be/ouroboros") - cmds.append("cd ~/ouroboros; sudo ./install_debug.sh /") + cmds = ["sudo apt-get install libprotobuf-c-dev --yes || true", + "sudo rm -r ~/ouroboros || true" + "git clone -b be git://ouroboros.ilabt.imec.be/ouroboros" + "cd ~/ouroboros; sudo ./install_debug.sh /"] for node in self.nodes: + ssh.aptitude_install(self.testbed, node, packages) ssh.execute_commands(self.testbed, node.ssh_config, cmds, time_out=None) diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index f0e67af..36e2d47 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -133,17 +133,17 @@ class Experiment(mod.Experiment): def install_prototype(self): logger.info("installing rlite on all nodes") - cmds = ["sudo apt-get update", - "sudo -E apt-get install g++ gcc cmake " - "linux-headers-$(uname -r) " - "protobuf-compiler libprotobuf-dev git --yes", - "rm -rf ~/rlite", + + packages = ["g++", "gcc", "cmake", "linux-headers-$(uname -r)", + "protobuf-compiler", "libprotobuf-dev", "git"] + + cmds = ["rm -rf ~/rlite", "cd ~; git clone https://github.com/vmaffione/rlite", "cd ~/rlite && ./configure && make && sudo make install", - "cd ~/rlite && sudo make depmod" - ] + "cd ~/rlite && sudo make depmod"] for node in self.nodes: + ssh.aptitude_install(self.testbed, node, packages) self.execute_proxy_commands(node, cmds) logger.info("installation complete") diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py index bb0eb2e..7b9112a 100644 --- a/rumba/ssh_support.py +++ b/rumba/ssh_support.py @@ -325,3 +325,31 @@ def setup_vlan(testbed, node, vlan_id, int_name): sudo("ethtool -K %(ifname)s txvlan off" % args)] execute_commands(testbed, node.ssh_config, cmds) + +def aptitude_install(testbed, node, packages): + """ + Installs packages through aptitude + + @param testbed: testbed info + @param node: the node to install the packages on + @param packages: list of packages + """ + + if testbed.username == 'root': + def sudo(s): + return s + else: + def sudo(s): + return 'sudo ' + s + + package_install = "apt-get install " + for package in packages: + package_install += package + " " + package_install += "--yes" + + cmds = [sudo("while fuser /var/lib/dpkg/lock > /dev/null 2>&1 " + + "do sleep 1; echo \"Waiting for dpkg...\"; done"), + sudo("apt-get update"), + sudo(package_install)] + + execute_proxy_commands(testbed, node.ssh_config, cmds, time_out=None) |