Changeset 622 for trunk/packages/sipb-xen-remote-server/files/usr/sbin
- Timestamp:
- Jun 21, 2008, 7:33:46 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-remote-server/files/usr/sbin/sipb-xen-remote-listvms
r617 r622 7 7 8 8 from subprocess import PIPE, Popen 9 try:10 from subprocess import CalledProcessError11 except ImportError:12 # Python 2.4 doesn't implement CalledProcessError13 class CalledProcessError(Exception):14 """This exception is raised when a process run by check_call() returns15 a non-zero exit status. The exit status will be stored in the16 returncode attribute."""17 def __init__(self, returncode, cmd):18 self.returncode = returncode19 self.cmd = cmd20 def __str__(self):21 return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)22 9 import sys 23 10 import yaml … … 36 23 for p in pipes: 37 24 if p.returncode != 0: 38 raise CalledProcessError(p.returncode, 'remctl') 25 raise RuntimeError("Command '%s' returned non-zero exit status %d" 26 % ('remctl', p.returncode)) 39 27 results = [yaml.load(o, yaml.CSafeLoader) for o in outputs] 40 28 results = filter(lambda x: x is not None, results)
Note: See TracChangeset
for help on using the changeset viewer.