api_errors.py revision 917
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
class ApiException(Exception):
pass
class ImageNotFoundException(ApiException):
"""Used when an image was not found"""
class VersionException(ApiException):
class InvalidCertException(ApiException):
pass
class PlanExistsException(ApiException):
pass
class AlreadyPreparedException(ApiException):
pass
class AlreadyExecutedException(ApiException):
pass
class ImageplanStateException(ApiException):
class IpkgOutOfDateException(ApiException):
pass
pass
class CanceledException(ApiException):
pass
class PlanMissingException(ApiException):
pass
pass
class PermissionsException(ApiException):
return _("Could not operate on %s\nbecause of insufficient "
"permissions. Please try the command again using pfexec\n"
else:
return _("""
Could not complete the operation because of insufficient permissions. Please
try the command again using pfexec or otherwise increase your permissions.
""")
assert path
return _("Could not operate on %s\nbecause the file is "
"in use. Please stop using the file and try the\n"
class PlanCreationException(ApiException):
res = []
if self.unfound_fmris:
s = _("""\
pkg: The following pattern(s) did not match any packages in the current
res += [ s ]
if self.multiple_matches:
s = _("pkg: '%s' matches multiple packages")
s = _("pkg: '%s' matches no installed packages")
s = _("pkg: '%s' is an illegal fmri")
s = _("pkg: the following package(s) violated constraints:")
res += [ s ]
s = _("'%s' supports the following architectures: %s")
a = _("Image architecture is defined as: %s")
class CatalogRefreshException(ApiException):
class InventoryException(ApiException):
outstr = ""
# Illegal FMRIs have their own __str__ method
outstr += "%s\n" % x
outstr += _("No matching package could be found for "
"the following FMRIs in any of the catalogs for "
"the current authorities:\n")
outstr += "%s\n" % x
return outstr
class IndexingException(ApiException):
""" The base class for all exceptions that can occur while indexing. """
"""This is used when the index is not in a correct state."""
pass
""" This is used when the indexer is unable to create, move, or remove
files or directories it should be able to. """
return "Could not remove or create " \
"%s because of incorrect " \
"permissions. Please correct this issue then " \
class NonLeafPackageException(ApiException):
"""Removal of a package which satisfies dependencies has been attempted.
The first argument to the constructor is the FMRI which we tried to
remove, and is available as the "fmri" member of the exception. The
second argument is the list of dependent packages that prevent the
removal of the package, and is available as the "dependents" member.
"""
"""Raised when the depot doesn't have versions of operations
that the client needs to operate successfully."""
s = "Unable to contact valid package server"
s += "\nEncountered the following error(s):\n%s" % \
return s
class BEException(ApiException):
class InvalidBENameException(BEException):
return _("'%s' is not a valid boot envirnment name." %
class BENamingNotSupported(BEException):
return _("""\
Boot environment naming during package install is not supported on this
version of OpenSolaris. Please image-update without the --be-name option.""")
class UnableToCopyBE(BEException):
return _("Unable to clone the current boot environment.")
class UnableToRenameBE(BEException):
d = {
}
return _("""\
A problem occurred while attempting to rename the boot environment
currently named %(orig)s to %(dest)s.""") % d
class UnableToMountBE(BEException):
return _("Unable to mount %(name)s at %(mt)s") % \
class BENameGivenOnDeadBE(BEException):
return _("""\
Naming a boot environment when operating on a non-live image is
not allowed.""")
s = _("Info does not recognize the following options:")
return s