From ade6bd4cda44c88b555f521641c6e01326ab0060 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 15 Mar 2018 11:19:46 +0100 Subject: prototypes: Improve ouroboros support for fake testbed This ameliorates the code by incorporating Marco's comments. It is now possible to run the Ouroboros plugin with the fake testbed plugin as non root. sudo is executed in case it was not done the last 15 minutes. The cleanup is also done properly. --- rumba/prototypes/ouroboros.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index c588405..a3c6c6c 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -69,7 +69,8 @@ class Experiment(mod.Experiment): def setup_ouroboros(self): if isinstance(self.testbed, fake.Testbed): - self.irmd = subprocess.Popen(["irmd"]) + subprocess.check_call('sudo -v'.split()) + self.irmd = subprocess.Popen(["sudo", "irmd"]) logger.info("Started IRMd, sleeping 2 seconds...") time.sleep(2) else: @@ -230,4 +231,5 @@ class Experiment(mod.Experiment): def _terminate_prototype(self): if isinstance(self.testbed, fake.Testbed): - self.irmd.terminate() + logger.info("Killing IRMd...") + subprocess.check_call('sudo killall -15 irmd'.split()) -- cgit v1.2.3