- Timestamp:
- Jun 2, 2008, 2:41:25 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-remote-server/files/usr/sbin/sipb-xen-remote-listvms
r552 r558 13 13 ### 14 14 15 def run(cmd):16 """17 Run the given command (a list of program and argument strings) and return the18 stdout as a string, raising a CalledProcessError if the program exited with a19 non-zero status.20 """21 p = Popen(cmd, stdout=PIPE)22 stdout = p.communicate()[0]23 if p.returncode != 0: raise CalledProcessError(p.returncode, cmd)24 return stdout25 26 15 def main(argv): 27 16 # Query each of the server for their VMs. … … 30 19 servers = [ 'black-mesa.mit.edu', 'sx-blade-2.mit.edu' ] 31 20 # XXX 32 results = [ safe_load(run(['remctl', server, 'remote', 'web', 'listvms'])) 33 for server in servers ] 21 pipes = [ Popen(['remctl', server, 'remote', 'web', 'listvms'], stdout=PIPE) 22 for server in servers ] 23 outputs = [ p.communicate()[0] for p in pipes ] 24 for p in pipes: 25 if p.returncode != 0: raise CalledProcessError(p.returncode, cmd) 26 results = [ safe_load(o) for o in outputs ] 34 27 results = filter( lambda x: x is not None, results ) 35 28
Note: See TracChangeset
for help on using the changeset viewer.