"""
Given a command and a list of hostnames or IPs, issue the command to each
node until it connects to one of the nodes.
"""
Given a command and a list of hostnames or IPs, issue the command to each
node until it connects to one of the nodes.
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:
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:
return (host, hostsdown, pipe.returncode,) + output
else:
return (host, hostsdown, pipe.returncode,) + output
return (host, hostsdown, pipe.returncode,) + output
else:
return (host, hostsdown, pipe.returncode,) + output