]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
orchestra/cluster: add sh() method 1421/head
authorKyr Shatskyy <kyrylo.shatskyy@suse.com>
Thu, 12 Mar 2020 16:32:33 +0000 (17:32 +0100)
committerKyr Shatskyy <kyrylo.shatskyy@suse.com>
Thu, 12 Mar 2020 16:32:33 +0000 (17:32 +0100)
For simplified outputs processing it might be usefull
to have a function will return all captured log from
all remote hosts in the given sequence.

Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
teuthology/orchestra/cluster.py

index 3f8e0c2e8fff41c97a0e24d43a3c975184510d96..50e078cd8ecdb3fc69a4750072c3338e8ca3cfa3 100644 (file)
@@ -63,6 +63,17 @@ class Cluster(object):
         remotes = sorted(self.remotes.keys(), key=lambda rem: rem.name)
         return [remote.run(**kwargs) for remote in remotes]
 
+    def sh(self, **kwargs):
+        """
+        Run a command on all the nodes in this cluster.
+
+        Goes through nodes in alphabetical order.
+
+        Returns a list of the command outputs correspondingly.
+        """
+        remotes = sorted(self.remotes.keys(), key=lambda rem: rem.name)
+        return [remote.sh(**kwargs) for remote in remotes]
+
     def write_file(self, file_name, content, sudo=False, perms=None, owner=None):
         """
         Write text to a file on each node.