summaryrefslogtreecommitdiff
path: root/ironic_python_agent/errors.py
diff options
context:
space:
mode:
authorJim Rollenhagen <jim@jimrollenhagen.com>2014-06-12 06:47:16 -0700
committerJim Rollenhagen <jim@jimrollenhagen.com>2014-06-24 06:50:54 -0700
commitc5df7070af638c5aaf4d6d2ab626475cc3610c0b (patch)
treefa8dd0dd8b78825200aa838e7453b7e3cd0ac360 /ironic_python_agent/errors.py
parent7b5575f6602f1199077c2819c18e5d587d5704ea (diff)
downloadironic-python-agent-c5df7070af638c5aaf4d6d2ab626475cc3610c0b.tar.gz
Better errors for execute() failures
Exceptions raised due to processutils.execute() failing now include stdout and stderr. Change-Id: Id5d1b5bc51d377f9f3c338cd7303ea800f76e5cd
Diffstat (limited to 'ironic_python_agent/errors.py')
-rw-r--r--ironic_python_agent/errors.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/ironic_python_agent/errors.py b/ironic_python_agent/errors.py
index a02b80b2..be61bdb6 100644
--- a/ironic_python_agent/errors.py
+++ b/ironic_python_agent/errors.py
@@ -159,10 +159,11 @@ class ImageWriteError(RESTError):
message = 'Error writing image to device.'
- def __init__(self, exit_code, device):
+ def __init__(self, device, exit_code, stdout, stderr):
super(ImageWriteError, self).__init__()
- self.details = 'Writing image to device {0} failed with exit code {1}.'
- self.details = self.details.format(device, exit_code)
+ self.details = ('Writing image to device {0} failed with exit code '
+ '{1}. stdout: {2}. stderr: {3}')
+ self.details = self.details.format(device, exit_code, stdout, stderr)
class ConfigDriveTooLargeError(RESTError):
@@ -183,10 +184,10 @@ class ConfigDriveWriteError(RESTError):
message = 'Error writing configdrive to device.'
- def __init__(self, exit_code, device):
- details = 'Writing configdrive to device {0} failed with exit code ' \
- '{1}.'
- details = details.format(device, exit_code)
+ def __init__(self, device, exit_code, stdout, stderr):
+ details = ('Writing configdrive to device {0} failed with exit code '
+ '{1}. stdout: {2}. stderr: {3}.')
+ details = details.format(device, exit_code, stdout, stderr)
super(ConfigDriveWriteError, self).__init__(details)
self.details = details
@@ -196,10 +197,11 @@ class SystemRebootError(RESTError):
message = 'Error rebooting system.'
- def __init__(self, exit_code):
+ def __init__(self, exit_code, stdout, stderr):
super(SystemRebootError, self).__init__()
- self.details = 'Reboot script failed with exit code {0}.'
- self.details = self.details.format(exit_code)
+ self.details = ('Reboot script failed with exit code {0}. stdout: '
+ '{1}. stderr: {2}.')
+ self.details = self.details.format(exit_code, stdout, stderr)
class BlockDeviceEraseError(RESTError):