コード例 #1
0
ファイル: plugin.py プロジェクト: decanio/broctl
 def execute(self, node, cmd):
     """Executes a command on the host for the given *node* of type
     `Node`_. Returns a tuple ``(success, output)`` in which ``success`` is
     True if the command ran successfully and ``output`` is the combined
     stdout/stderr output."""
     result = execute.executeCmdsParallel([(node, cmd)])[0]
     return (result[1], result[2])
コード例 #2
0
ファイル: plugin.py プロジェクト: aming2007/dpi-test-suite
 def executeParallel(self, cmds):
     """Executes a set of commands in parallel on multiple hosts. ``cmds``
     is a list of tuples ``(node, cmd)``, in which the *node* is a `Node`_
     instance and *cmd* is a string with the command to execute for it. The
     method returns a list of tuples ``(node, success, output)``, in which
     ``success`` is True if the command ran successfully and ``output`` is
     the combined stdout/stderr output for the corresponding ``node``."""
     return execute.executeCmdsParallel(cmds)
コード例 #3
0
 def executeParallel(self, cmds):
     """Executes a set of commands in parallel on multiple hosts. ``cmds``
     is a list of tuples ``(node, cmd)``, in which the *node* is a `Node`_
     instance and *cmd* is a string with the command to execute for it. The
     method returns a list of tuples ``(node, success, output)``, in which
     ``success`` is True if the command ran successfully and ``output`` is
     the combined stdout/stderr output for the corresponding ``node``."""
     return execute.executeCmdsParallel(cmds)
コード例 #4
0
ファイル: control.py プロジェクト: pombredanne/broctl
def executeCmd(nodes, cmd):
    hadError = False
    for (node, success, output) in execute.executeCmdsParallel([(n, cmd) for n in nodes]):
        out = output and "\n> ".join(output) or ""
        util.output("[%s] %s\n> %s" % (node.name, (success and " " or "error"), out))
        if not success:
            hadError = True
    return not hadError
コード例 #5
0
ファイル: control.py プロジェクト: aming2007/dpi-test-suite
def executeCmd(nodes, cmd):
    for (node, success, output) in execute.executeCmdsParallel([(n, cmd) for n in nodes]):
        util.output("[%s] %s\n> %s" % (node.name, (success and " " or "error"), "\n> ".join(output)))
コード例 #6
0
 def execute(self, node, cmd):
     """Executes a command on the host for the given *node* of type
     `Node`_. Returns a tuple ``(success, output)`` in which ``success`` is
     True if the command ran successfully and ``output`` is the combined
     stdout/stderr output."""
     return execute.executeCmdsParallel([node, cmd])
コード例 #7
0
def executeCmd(nodes, cmd):
    for (node, success,
         output) in execute.executeCmdsParallel([(n, cmd) for n in nodes]):
        util.output("[%s] %s\n> %s" %
                    (node.name,
                     (success and " " or "error"), "\n> ".join(output)))