aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rumba/ssh_support.py2
-rw-r--r--rumba/storyboard.py29
2 files changed, 18 insertions, 13 deletions
diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py
index e23a18e..06e7699 100644
--- a/rumba/ssh_support.py
+++ b/rumba/ssh_support.py
@@ -406,7 +406,7 @@ def aptitude_install(testbed, node, packages):
return s
else:
def sudo(s):
- return 'sudo' + s
+ return 'sudo ' + s
package_install = " DEBIAN_FRONTEND=noninteractive apt-get install "
for package in packages:
diff --git a/rumba/storyboard.py b/rumba/storyboard.py
index c6da6cb..6d9739c 100644
--- a/rumba/storyboard.py
+++ b/rumba/storyboard.py
@@ -729,25 +729,30 @@ class StoryBoard(_SBEntity):
action = functools.partial(self.run_command, node, command)
self._script.add_event(Event(action, ev_time=t))
- def run_command(self, node, command):
+ def run_command(self, nodes, command):
"""
- Runs a command (or several) on a given node, immediately.
+ Runs a command (or several) on a given (set of) node(s), immediately.
- :param node: the node on which the command should be run
- :type node: `rumba.model.Node` or `str`
+ :param nodes: the nodes on which the command should be run
+ :type nodes: `rumba.model.Node` or `str` or a list of these
:param command: the command(s) to be run
:type command: `str` or `list` of `str`
"""
if self.experiment is None:
raise ValueError("Experiment needed to run commands.")
- if isinstance(node, str):
- node = self.node_map[node]
- if node not in self.experiment.nodes:
- raise ValueError('Cannot run command on node %s, '
- 'not in experiment.' % (node.name,))
- if isinstance(command, str):
- command = [command]
- node.execute_commands(command)
+ if not isinstance(nodes, list):
+ _nodes = [nodes]
+ else:
+ _nodes = nodes
+ for _node in _nodes:
+ if isinstance(_node, str):
+ _node = self.node_map[_node]
+ if _node not in self.experiment.nodes:
+ raise ValueError('Cannot run command on node %s, '
+ 'not in experiment.' % (_node.name,))
+ if isinstance(command, str):
+ command = [command]
+ _node.execute_commands(command)
def add_event(self, event):
"""