Changeset 622 for trunk/packages


Ignore:
Timestamp:
Jun 21, 2008, 7:33:46 PM (16 years ago)
Author:
price
Message:

not worth defining an exception class for one invocation site

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-remote-server/files/usr/sbin/sipb-xen-remote-listvms

    r617 r622  
    77
    88from subprocess import PIPE, Popen
    9 try:
    10     from subprocess import CalledProcessError
    11 except ImportError:
    12     # Python 2.4 doesn't implement CalledProcessError
    13     class CalledProcessError(Exception):
    14         """This exception is raised when a process run by check_call() returns
    15         a non-zero exit status. The exit status will be stored in the
    16         returncode attribute."""
    17         def __init__(self, returncode, cmd):
    18             self.returncode = returncode
    19             self.cmd = cmd
    20         def __str__(self):
    21             return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)
    229import sys
    2310import yaml
     
    3623    for p in pipes:
    3724        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))
    3927    results = [yaml.load(o, yaml.CSafeLoader) for o in outputs]
    4028    results = filter(lambda x: x is not None, results)
Note: See TracChangeset for help on using the changeset viewer.