diff options
Diffstat (limited to 'ironic_python_agent/errors.py')
-rw-r--r-- | ironic_python_agent/errors.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/ironic_python_agent/errors.py b/ironic_python_agent/errors.py index 7219fbda..a7abdb30 100644 --- a/ironic_python_agent/errors.py +++ b/ironic_python_agent/errors.py @@ -247,3 +247,43 @@ class UnknownNodeError(Exception): if message is not None: self.message = message super(UnknownNodeError, self).__init__(self.message) + + +class HardwareManagerNotFound(Exception): + """Error raised when no valid HardwareManager can be found.""" + + message = 'No valid HardwareManager found.' + + def __init__(self, message=None): + if message is not None: + self.message = message + super(HardwareManagerNotFound, self).__init__(self.message) + + +class HardwareManagerMethodNotFound(RESTError): + """Error raised when all HardwareManagers fail to handle a method.""" + + msg = 'No HardwareManager found to handle method' + message = msg + '.' + + def __init__(self, method=None): + if method is not None: + self.details = (self.msg + ': "{0}".').format(method) + else: + self.details = self.message + super(HardwareManagerMethodNotFound, self).__init__(self.details) + + +class IncompatibleHardwareMethodError(RESTError): + """Error raised when HardwareManager method is incompatible with node + hardware. + """ + + message = 'HardwareManager method is not compatible with hardware.' + + def __init__(self, details=None): + if details is not None: + self.details = details + else: + self.details = self.message + super(IncompatibleHardwareMethodError, self).__init__(self.details) |