2N/A#! /usr/bin/python2.6
2N/A#
2N/A# CDDL HEADER START
2N/A#
2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License (the "License").
2N/A# You may not use this file except in compliance with the License.
2N/A#
2N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A# or http://www.opensolaris.org/os/licensing.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A#
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A#
2N/A# CDDL HEADER END
2N/A#
2N/A# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
2N/A#
2N/A
2N/A"""
2N/AA Python package for management of all things Boot
2N/A"""
2N/A
2N/A
2N/Aclass BootmgmtError(Exception):
2N/A def __init__(self, msg, xcpt=None):
2N/A self.msg = msg
2N/A self.xcpt = xcpt
2N/A super(BootmgmtError, self).__init__()
2N/A
2N/A def __str__(self):
2N/A if not self.xcpt is None:
2N/A return self.msg + ': (' + str(self.xcpt) + ')'
2N/A else:
2N/A return self.msg
2N/A
2N/A
2N/Aclass BootmgmtNotSupportedError(BootmgmtError):
2N/A pass
2N/A
2N/A
2N/Aclass BootmgmtArgumentError(BootmgmtError):
2N/A pass
2N/A
2N/A
2N/Aclass BootmgmtMissingInfoError(BootmgmtError):
2N/A pass
2N/A
2N/A
2N/Aclass BootmgmtUnsupportedOperationError(BootmgmtError):
2N/A pass
2N/A
2N/A
2N/Aclass BootmgmtPropertyWriteError(BootmgmtError):
2N/A pass
2N/A
2N/Aclass BootmgmtMalformedPropertyNameError(BootmgmtError):
2N/A pass
2N/A
2N/A
2N/Aclass BootmgmtMalformedPropertyValueError(BootmgmtError):
2N/A def __init__(self, propname, propval, explanation=None):
2N/A expl = 'Invalid value specified for property "%s": %s' % \
2N/A (str(propname), str(propval))
2N/A if explanation:
2N/A expl = expl + ' (%s)' % explanation
2N/A super(BootmgmtMalformedPropertyValueError, self).__init__(expl)
2N/A self.propname = propname
2N/A self.propval = propval
2N/A self.explanation = explanation
2N/A
2N/A
2N/Aclass BootmgmtReadError(BootmgmtError):
2N/A pass
2N/A
2N/A
2N/Aclass BootmgmtWriteError(BootmgmtError):
2N/A pass
2N/A
2N/A
2N/Aclass BootmgmtUnsupportedPlatformError(BootmgmtError):
2N/A pass
2N/A
2N/A
2N/Aclass BootmgmtInterfaceCodingError(BootmgmtError):
2N/A pass
2N/A
2N/A
2N/Aclass BootmgmtConfigReadError(BootmgmtError):
2N/A pass
2N/A
2N/A
2N/Aclass BootmgmtConfigWriteError(BootmgmtError):
2N/A def __init__(self, msg, xcpt=None, retcode=None):
2N/A """Record a return code as well as a message and exception.
2N/A """
2N/A self.retcode = retcode
2N/A super(BootmgmtConfigWriteError, self).__init__(msg, xcpt)
2N/A
2N/A
2N/Aclass BootmgmtIncompleteBootConfigError(BootmgmtError):
2N/A pass
2N/A
2N/A
2N/Aclass BootmgmtUnsupportedPropertyError(BootmgmtUnsupportedOperationError):
2N/A pass
2N/A
2N/Aclass BootmgmtInvalidBootloaderError(BootmgmtNotSupportedError):
2N/A pass