X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/blobdiff_plain/0d3e8bfe72fd02a0829ff5f5a7d73b954651cb8e..6c27d7937d0d2c6cc778f02b05abbbe286b01633:/python/remote/bcast.py diff --git a/python/remote/bcast.py b/python/remote/bcast.py index 0d7dba2..4544af7 100644 --- a/python/remote/bcast.py +++ b/python/remote/bcast.py @@ -9,11 +9,14 @@ def bcast(cmd, hosts = [h.hostname for h in config.hosts]): the same as the order of the hosts). """ pipes = [(host, - Popen(['remctl', host, 'remote', 'web', cmd], stdout=PIPE)) + Popen(['remctl', host, 'remote', 'web', cmd], stdout=PIPE, stderr=PIPE)) for host in hosts] - outputs = [(s, p.communicate()[0]) for (s, p) in pipes] + outputs = dict((s, p.communicate()) for (s, p) in pipes) for (s, p) in pipes: if p.returncode != 0: - raise RuntimeError("remctl to host %s returned non-zero exit status %d" - % (s, p.returncode)) - return [(s, yaml.load(o, yaml.CSafeLoader)) for (s, o) in outputs] + if outputs[s][1].startswith('remctl: cannot connect to %s' % s): + del outputs[s] + else: + raise RuntimeError("remctl to host %s returned non-zero exit status %d; stderr:\n%s" + % (s, p.returncode, outputs[s][1])) + return [(s, yaml.load(o[0], yaml.CSafeLoader)) for (s, o) in outputs.iteritems()]