def copytonodes(nodespec, srcfile, destfile, verbose=False, user=None): nodes = expand(nodespec) if len(nodes) == 0: print "Need at least one node to run on" sys.exit(1) if verbose: print "Copying from %s to %s" % (srcfile, destfile) for node in nodes: nc = NodeConnection(node, user) nc.connect(verbose=verbose) nc.exec_command(cmd) nc.print_output()
def runonnodes(nodespec, cmd, dshbak=False, verbose=False, user=None): nodes = expand(nodespec) if len(nodes) == 0: print "Need at least one node to run on" sys.exit(1) for node in nodes: nc = NodeConnection(node, user) nc.connect(verbose=verbose) nc.exec_command(cmd) if not dshbak: print "--------------- %s ---------------" % (node) nc.print_output() else: nc.print_output(str(node) + ": ")