summaryrefslogtreecommitdiff
path: root/cxmanage_api/cx_exceptions.py
diff options
context:
space:
mode:
Diffstat (limited to 'cxmanage_api/cx_exceptions.py')
-rw-r--r--cxmanage_api/cx_exceptions.py90
1 files changed, 53 insertions, 37 deletions
diff --git a/cxmanage_api/cx_exceptions.py b/cxmanage_api/cx_exceptions.py
index 410b5d7..5e0c931 100644
--- a/cxmanage_api/cx_exceptions.py
+++ b/cxmanage_api/cx_exceptions.py
@@ -1,4 +1,7 @@
-# Copyright (c) 2012, Calxeda Inc.
+"""Calxeda: cx_exceptions.py"""
+
+
+# Copyright (c) 2012-2013, Calxeda Inc.
#
# All rights reserved.
#
@@ -28,12 +31,46 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
-"""Defines the custom exceptions used by the cxmanage_api project."""
+#
+# We expose these here so a user does not have to import from pyipmi or tftpy.
+#
+# pylint: disable=W0611
+#
from pyipmi import IpmiError
+
from tftpy.TftpShared import TftpException
+#
+# Defines the custom exceptions used by the cxmanage_api project.
+#
+
+class EEPROMUpdateError(Exception):
+ """Raised when an error is encountered while updating the EEPROM
+
+ >>> from cxmanage_api.cx_exceptions import TimeoutError
+ >>> raise TimeoutError('My custom exception text!')
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+ cxmanage_api.cx_exceptions.TimeoutError: My custom exception text!
+
+ :param msg: Exceptions message and details to return to the user.
+ :type msg: string
+ :raised: When an error is encountered while updating the EEPROM
+
+ """
+
+ def __init__(self, msg):
+ """Default constructor for the EEPROMUpdateError class."""
+ super(EEPROMUpdateError, self).__init__()
+ self.msg = msg
+
+ def __str__(self):
+ """String representation of this Exception class."""
+ return self.msg
+
+
class TimeoutError(Exception):
"""Raised when a timeout has been reached.
@@ -109,31 +146,6 @@ class NoSensorError(Exception):
return self.msg
-class NoFirmwareInfoError(Exception):
- """Raised when the firmware info cannot be obtained from a node.
-
- >>> from cxmanage_api.cx_exceptions import NoFirmwareInfoError
- >>> raise NoFirmwareInfoError('My custom exception text!')
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- cxmanage_api.cx_exceptions.NoFirmwareInfoError: My custom exception text!
-
- :param msg: Exceptions message and details to return to the user.
- :type msg: string
- :raised: When the firmware info cannot be obtained from a node.
-
- """
-
- def __init__(self, msg):
- """Default constructor for the NoFirmwareInfoError class."""
- super(NoFirmwareInfoError, self).__init__()
- self.msg = msg
-
- def __str__(self):
- """String representation of this Exception class."""
- return self.msg
-
-
class SocmanVersionError(Exception):
"""Raised when there is an error with the users socman version.
@@ -284,26 +296,25 @@ class InvalidImageError(Exception):
return self.msg
-class UnknownBootCmdError(Exception):
- """Raised when the boot command is not: run bootcmd_pxe, run bootcmd_sata,
- run bootcmd_mmc, setenv bootdevice, or reset.
+class UbootenvError(Exception):
+ """Raised when the UbootEnv class fails to interpret the ubootenv
+ environment variables.
- >>> from cxmanage_api.cx_exceptions import UnknownBootCmdError
- >>> raise UnknownBootCmdError('My custom exception text!')
+ >>> from cxmanage_api.cx_exceptions import UbootenvError
+ >>> raise UbootenvError('My custom exception text!')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
- cxmanage_api.cx_exceptions.UnknownBootCmdError: My custom exception text!
+ cxmanage_api.cx_exceptions.UbootenvError: My custom exception text!
:param msg: Exceptions message and details to return to the user.
:type msg: string
- :raised: When the boot command is not: run bootcmd_pxe, run bootcmd_sata,
- run bootcmd_mmc, setenv bootdevice, or reset.
+ :raised: When ubootenv settings are unrecognizable.
"""
def __init__(self, msg):
- """Default constructor for the UnknownBootCmdError class."""
- super(UnknownBootCmdError, self).__init__()
+ """Default constructor for the UbootenvError class."""
+ super(UbootenvError, self).__init__()
self.msg = msg
def __str__(self):
@@ -330,6 +341,7 @@ class CommandFailedError(Exception):
def __init__(self, results, errors):
"""Default constructor for the CommandFailedError class."""
+ super(CommandFailedError, self).__init__()
self.results = results
self.errors = errors
@@ -390,4 +402,8 @@ class IPDiscoveryError(Exception):
return self.msg
+class ParseError(Exception):
+ """Raised when there's an error parsing some output"""
+ pass
+
# End of file: exceptions.py