X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/blobdiff_plain/73ef973290945bd454e27cca6de4727445fc4436..74bf6f0c14efbc2e33fd9f8d79bdb807286725ca:/python/remote/monocast.py diff --git a/python/remote/monocast.py b/python/remote/monocast.py index 1b39b57..033d154 100644 --- a/python/remote/monocast.py +++ b/python/remote/monocast.py @@ -4,7 +4,7 @@ import random hostnames = [ h.hostname for h in config.hosts ] -def monocast(args, hosts = hostnames, randomize = True): +def monocast(args, hostnames = hostnames, randomize = True): """ Given a command and a list of hostnames or IPs, issue the command to each node until it connects to one of the nodes. @@ -17,17 +17,15 @@ def monocast(args, hosts = hostnames, randomize = True): stderr of remctl """ if(randomize): - hosts = random.sample(hosts, len(hosts)) + hostnames = random.sample(hostnames, len(hostnames)) hostsdown = [] - for host in hosts: + for host in hostnames: pipe = Popen(['remctl', host, 'remote', 'web'] + args, stdout=PIPE, stderr=PIPE) output = pipe.communicate() if pipe.returncode != 0: if output[1].startswith('remctl: cannot connect to %s' % host): hostsdown.append(host) else: - #raise RuntimeError("remctl to host %s returned non-zero exit status %d; stderr:\n%s" - # % (host, pipe.returncode, output[1])) return (host, hostsdown, pipe.returncode,) + output else: return (host, hostsdown, pipe.returncode,) + output