api_errors.py revision 1191
2454dfa32c93c20a8522c6ed42fe057baaac9f9aStephan Bosch#!/usr/bin/python2.4
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen#
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# CDDL HEADER START
16f816d3f3c32ae3351834253f52ddd0212bcbf3Timo Sirainen#
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen# The contents of this file are subject to the terms of the
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen# Common Development and Distribution License (the "License").
58be9d6bcc3800f5b3d76a064ee767fbe31a5a8aTimo Sirainen# You may not use this file except in compliance with the License.
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen#
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen# or http://www.opensolaris.org/os/licensing.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# See the License for the specific language governing permissions
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# and limitations under the License.
e9594e86dc601b72c1636f2b901dcfbf4ffaf47fAki Tuomi#
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# When distributing Covered Code, include this CDDL HEADER in each
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# If applicable, add the following below this CDDL HEADER, with the
ab1e5b156d1b5480d36ed6e8e06197339d803038Timo Sirainen# fields enclosed by brackets "[]" replaced with your own identifying
ab1e5b156d1b5480d36ed6e8e06197339d803038Timo Sirainen# information: Portions Copyright [yyyy] [name of copyright owner]
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen#
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# CDDL HEADER END
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen#
e8fd7988ec183fb6c104aed19a61f1a096c51d34Timo Sirainen
e8fd7988ec183fb6c104aed19a61f1a096c51d34Timo Sirainen#
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# Use is subject to license terms.
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainen#
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainen
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainenimport os
46b823ac3bce2c0f9f0fc73911e48d3a77b04fbeTimo Sirainenimport urlparse
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainen
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainen# EmptyI for argument defaults; can't import from misc due to circular
d35fee8d1e5e31614dba5e64d45ed23c7d6bfa53Timo Sirainen# dependency.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenEmptyI = tuple()
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainen
ad850190d946d34966a56838cfdb216e021b5b5fTimo Sirainenclass ApiException(Exception):
ad850190d946d34966a56838cfdb216e021b5b5fTimo Sirainen pass
d35fee8d1e5e31614dba5e64d45ed23c7d6bfa53Timo Sirainen
d35fee8d1e5e31614dba5e64d45ed23c7d6bfa53Timo Sirainenclass ImageNotFoundException(ApiException):
d35fee8d1e5e31614dba5e64d45ed23c7d6bfa53Timo Sirainen """Used when an image was not found"""
d35fee8d1e5e31614dba5e64d45ed23c7d6bfa53Timo Sirainen def __init__(self, user_specified, user_dir, root_dir):
d35fee8d1e5e31614dba5e64d45ed23c7d6bfa53Timo Sirainen ApiException.__init__(self)
d35fee8d1e5e31614dba5e64d45ed23c7d6bfa53Timo Sirainen self.user_specified = user_specified
d35fee8d1e5e31614dba5e64d45ed23c7d6bfa53Timo Sirainen self.user_dir = user_dir
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.root_dir = root_dir
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
19e8adccba16ff419f5675b1575358c2956dce83Timo Sirainenclass VersionException(ApiException):
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainen def __init__(self, expected_version, received_version):
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainen ApiException.__init__(self)
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainen self.expected_version = expected_version
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainen self.received_version = received_version
19e8adccba16ff419f5675b1575358c2956dce83Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass PlanExistsException(ApiException):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def __init__(self, plan_type):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen ApiException.__init__(self)
8aacc9e7c84f8376822823ec98c2f551d4919b2eTimo Sirainen self.plan_type = plan_type
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass ActuatorException(ApiException):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def __init__(self, e):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen ApiException.__init__(self)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.exception = e
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen def __str__(self):
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen return str(self.exception)
5bd1c1d4fe3265d5e6b6054044fd6d78e42c9d0aTimo Sirainen
5bd1c1d4fe3265d5e6b6054044fd6d78e42c9d0aTimo Sirainenclass PrematureExecutionException(ApiException):
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen pass
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass AlreadyPreparedException(ApiException):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen pass
6e235046e1d8e9d89fc948f5c623676c20421a28Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass AlreadyExecutedException(ApiException):
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen pass
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainenclass ImageplanStateException(ApiException):
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen def __init__(self, state):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen ApiException.__init__(self)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.state = state
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass IpkgOutOfDateException(ApiException):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen pass
f330b7d9e14255fc06bc82908d9bc5a12cccb424Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass ImageUpdateOnLiveImageException(ApiException):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen pass
abe7afb8f1766fbcef1b9df513109e43d7d16e49Timo Sirainen
abe7afb8f1766fbcef1b9df513109e43d7d16e49Timo Sirainenclass CanceledException(ApiException):
abe7afb8f1766fbcef1b9df513109e43d7d16e49Timo Sirainen pass
abe7afb8f1766fbcef1b9df513109e43d7d16e49Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainenclass PlanMissingException(ApiException):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen pass
abe7afb8f1766fbcef1b9df513109e43d7d16e49Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainenclass NoPackagesInstalledException(ApiException):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen pass
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainenclass PermissionsException(ApiException):
2131ef7a3390f15ea6a958256ea54908f1096350Timo Sirainen def __init__(self, path):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen ApiException.__init__(self)
2131ef7a3390f15ea6a958256ea54908f1096350Timo Sirainen self.path = path
2131ef7a3390f15ea6a958256ea54908f1096350Timo Sirainen
2131ef7a3390f15ea6a958256ea54908f1096350Timo Sirainen def __str__(self):
abe7afb8f1766fbcef1b9df513109e43d7d16e49Timo Sirainen if self.path:
abe7afb8f1766fbcef1b9df513109e43d7d16e49Timo Sirainen return _("Could not operate on %s\nbecause of "
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen "insufficient permissions. Please try the command "
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen "again using pfexec\nor otherwise increase your "
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen "privileges.") % self.path
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen else:
f330b7d9e14255fc06bc82908d9bc5a12cccb424Timo Sirainen return _("""
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo SirainenCould not complete the operation because of insufficient permissions. Please
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainentry the command again using pfexec or otherwise increase your privileges.
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen""")
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainenclass FileInUseException(PermissionsException):
f330b7d9e14255fc06bc82908d9bc5a12cccb424Timo Sirainen def __init__(self, path):
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen PermissionsException.__init__(self, path)
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen assert path
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen
f330b7d9e14255fc06bc82908d9bc5a12cccb424Timo Sirainen def __str__(self):
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen return _("Could not operate on %s\nbecause the file is "
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen "in use. Please stop using the file and try the\n"
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen "operation again.") % self.path
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainenclass PlanCreationException(ApiException):
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen def __init__(self, unmatched_fmris=EmptyI, multiple_matches=EmptyI,
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen missing_matches=EmptyI, illegal=EmptyI,
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen constraint_violations=EmptyI, badarch=EmptyI):
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen ApiException.__init__(self)
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen self.unmatched_fmris = unmatched_fmris
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen self.multiple_matches = multiple_matches
f330b7d9e14255fc06bc82908d9bc5a12cccb424Timo Sirainen self.missing_matches = missing_matches
f330b7d9e14255fc06bc82908d9bc5a12cccb424Timo Sirainen self.illegal = illegal
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen self.constraint_violations = constraint_violations
f330b7d9e14255fc06bc82908d9bc5a12cccb424Timo Sirainen self.badarch = badarch
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen def __str__(self):
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen res = []
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen if self.unmatched_fmris:
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen s = _("""\
2131ef7a3390f15ea6a958256ea54908f1096350Timo SirainenThe following pattern(s) did not match any packages in the current catalog.
69e03a846f6980144aa75bff0590c04852bffbbcTimo SirainenTry relaxing the pattern, refreshing and/or examining the catalogs:""")
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen res += [s]
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen res += ["\t%s" % p for p in self.unmatched_fmris]
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen if self.multiple_matches:
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen s = _("'%s' matches multiple packages")
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen for p, lst in self.multiple_matches:
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen res.append(s % p)
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen for pfmri in lst:
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen res.append("\t%s" % pfmri)
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen s = _("'%s' matches no installed packages")
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen res += [ s % p for p in self.missing_matches ]
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen s = _("'%s' is an illegal fmri")
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen res += [ s % p for p in self.illegal ]
66ecc94150cbce23aad3240135e0782e0a74d479Timo Sirainen
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen if self.constraint_violations:
04b8a90af181cc4c7959266855e8ed50a22ed413Timo Sirainen s = _("The following package(s) violated constraints:")
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen res += [s]
2131ef7a3390f15ea6a958256ea54908f1096350Timo Sirainen res += ["\t%s" % p for p in self.constraint_violations]
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen if self.badarch:
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen s = _("'%s' supports the following architectures: %s")
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen a = _("Image architecture is defined as: %s")
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen res += [ s % (self.badarch[0],
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen ", ".join(self.badarch[1]))]
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen res += [ a % (self.badarch[2])]
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen return '\n'.join(res)
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen
66ecc94150cbce23aad3240135e0782e0a74d479Timo Sirainen
2131ef7a3390f15ea6a958256ea54908f1096350Timo Sirainenclass ActionExecutionError(ApiException):
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen """An error was encountered executing an action.
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen In particular, this exception indicates that something went wrong in the
85da8c055280cd45553b6b335e9fb226d6e2801eTimo Sirainen application (or unapplication) of the action to the system, not an error
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen in the pkg(5) code.
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen The 'msg' argument can provide a more specific message than what would
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen be returned from, and 'ignoreerrno' can be set to True to indicate that
2131ef7a3390f15ea6a958256ea54908f1096350Timo Sirainen the sterror() text is misleading, and shouldn't be displayed.
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen """
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen
69e03a846f6980144aa75bff0590c04852bffbbcTimo Sirainen def __init__(self, action, exception, msg=None, ignoreerrno=False):
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen self.action = action
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.exception = exception
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainen self.msg = msg
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainen self.ignoreerrno = ignoreerrno
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen def __str__(self):
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen errno = ""
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen if not self.ignoreerrno and hasattr(self.exception, "errno"):
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen errno = "[errno %d: %s]" % (self.exception.errno,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen os.strerror(self.exception.errno))
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen msg = self.msg or ""
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainen # Fall back on the wrapped exception if we don't have anything
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainen # useful.
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainen if not errno and not msg:
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen return str(self.exception)
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen if errno and msg:
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen return "%s: %s" % (errno, msg)
58be9d6bcc3800f5b3d76a064ee767fbe31a5a8aTimo Sirainen
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainen # If we only have one of the two, no need for the colon.
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen return "%s%s" % (errno, msg)
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainenclass CatalogCacheError(ApiException):
6b85bc4b03e552cfaeeae872d63c2d8ac5fcb7c4Timo Sirainen """Base class used for all catalog cache errors."""
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def __init__(self, *args, **kwargs):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen ApiException.__init__(self, *args)
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen if args:
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen self.data = args[0]
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen else:
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen self.data = None
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen self.args = kwargs
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainenclass CatalogCacheBadVersion(CatalogCacheError):
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen """Used to indicate that the catalog cache is invalid or is not of a
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen supported version."""
620b5ed41650da63b0ba15c489f9f312231d5d9bTimo Sirainen
25c22e54d1071d120641e9eecd0023e7373e65ffTimo Sirainen def __str__(self):
25c22e54d1071d120641e9eecd0023e7373e65ffTimo Sirainen return _("Unsupported catalog cache Version: '%(found)s'; "
25c22e54d1071d120641e9eecd0023e7373e65ffTimo Sirainen "expected: '%(expected)s'") % { "found": self.data,
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen "expected": self.args["expected"] }
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainenclass CatalogCacheInvalid(CatalogCacheError):
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen """Used to indicate that the catalog cache is corrupt or otherwise
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen unparseable."""
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen def __str__(self):
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen return _("Catalog cache is corrupt or invalid; error "
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen "encountered while reading:\nline %(lnum)d: '%(data)s'") % {
25c22e54d1071d120641e9eecd0023e7373e65ffTimo Sirainen "lnum": self.args["line_number"], "data": self.data }
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainenclass CatalogCacheMissing(CatalogCacheError):
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen """Used to indicate that the catalog cache is missing."""
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen def __str__(self):
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen return _("Catalog cache is missing.")
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainenclass CatalogRefreshException(ApiException):
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen def __init__(self, failed, total, succeeded, message=None):
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen ApiException.__init__(self)
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen self.failed = failed
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen self.total = total
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen self.succeeded = succeeded
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen self.message = message
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
25c22e54d1071d120641e9eecd0023e7373e65ffTimo Sirainenclass InventoryException(ApiException):
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen def __init__(self, notfound=EmptyI, illegal=EmptyI):
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen ApiException.__init__(self)
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen self.notfound = notfound
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen self.illegal = illegal
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen assert(self.notfound or self.illegal)
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen def __str__(self):
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen outstr = ""
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen for x in self.illegal:
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen # Illegal FMRIs have their own __str__ method
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen outstr += "%s\n" % x
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen if self.notfound:
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen outstr += _("No matching package could be found for "
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen "the following FMRIs in any of the catalogs for "
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen "the current publishers:\n")
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen
f0ff961282e618945dfe997dc45ff95d656e5790Timo Sirainen for x in self.notfound:
25c22e54d1071d120641e9eecd0023e7373e65ffTimo Sirainen outstr += "%s\n" % x
25c22e54d1071d120641e9eecd0023e7373e65ffTimo Sirainen
25c22e54d1071d120641e9eecd0023e7373e65ffTimo Sirainen return outstr
25c22e54d1071d120641e9eecd0023e7373e65ffTimo Sirainen
8ac66221e8fdc2c5523cff1893e0d1c5de25fa49Timo Sirainen
8ac66221e8fdc2c5523cff1893e0d1c5de25fa49Timo Sirainen# SearchExceptions
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass SearchException(ApiException):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen """Based class used for all search-related api exceptions."""
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen pass
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass MainDictParsingException(SearchException):
920b9f0fdfa5a5d7763e05736601a31bcb291a53Timo Sirainen """This is used when the main dictionary could not parse a line."""
a40d26f83af808a0ea1e212c001d682a96d870b0Timo Sirainen def __init__(self, e):
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainen SearchException.__init__(self)
a40d26f83af808a0ea1e212c001d682a96d870b0Timo Sirainen self.e = e
a40d26f83af808a0ea1e212c001d682a96d870b0Timo Sirainen
e192a3b1ca8ae857e7d87298ea507d32977ba570Timo Sirainen def __str__(self):
e192a3b1ca8ae857e7d87298ea507d32977ba570Timo Sirainen return str(self.e)
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainen
e192a3b1ca8ae857e7d87298ea507d32977ba570Timo Sirainen
811f2e26d9782d9cb99fdf82e18ffa0a77564fe2Timo Sirainenclass MalformedSearchRequest(SearchException):
a40d26f83af808a0ea1e212c001d682a96d870b0Timo Sirainen """Raised when the server cannot understand the format of the
f501ad38c51cf1d8f4f84313922c785e6ae6e81fTimo Sirainen search request."""
c4877db8b6559846f4b58be8e42422dc734c193fTimo Sirainen
6bc0f424bcdb9119d8159874cf98adfa53eefd9aTimo Sirainen def __init__(self, url):
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen SearchException.__init__(self)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.url = url
f501ad38c51cf1d8f4f84313922c785e6ae6e81fTimo Sirainen
8b9342aa96b2f297e23afb261f9f7dd859800952Timo Sirainen def __str__(self):
8b9342aa96b2f297e23afb261f9f7dd859800952Timo Sirainen return str(self.url)
8b9342aa96b2f297e23afb261f9f7dd859800952Timo Sirainen
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass NegativeSearchResult(SearchException):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen """Returned when the search cannot find any matches."""
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen def __init__(self, url):
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen SearchException.__init__(self)
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen self.url = url
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen def __str__(self):
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen return _("The search at url %s returned no results.") % self.url
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainenclass ProblematicSearchServers(SearchException):
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen """This class wraps exceptions which could appear while trying to
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen do a search request."""
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen def __init__(self, failed=EmptyI, invalid=EmptyI, unsupported=EmptyI):
9af06b76539445d2d84d6e1bcb91685b6abeb4e0Timo Sirainen SearchException.__init__(self)
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen self.failed_servers = failed
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen self.invalid_servers = invalid
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen self.unsupported_servers = unsupported
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen def __str__(self):
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen s = _("Some servers failed to respond appropriately:\n")
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen for pub, err in self.failed_servers:
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen s += _("%(o)s:\n%(msg)s\n") % \
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen { "o": pub, "msg": err}
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen for pub in self.invalid_servers:
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen s += _("%s did not return a valid response.\n" \
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen % pub)
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen if len(self.unsupported_servers) > 0:
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen s += _("Some servers don't support requested search"
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen " operation:\n")
9af06b76539445d2d84d6e1bcb91685b6abeb4e0Timo Sirainen for pub, err in self.unsupported_servers:
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen s += _("%(o)s:\n%(msg)s\n") % \
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen { "o": pub, "msg": err}
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen return s
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainenclass SlowSearchUsed(SearchException):
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen """This exception is thrown when a local search is performed without
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen an index. It's raised after all results have been yielded."""
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen def __str__(self):
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen return _("Search performance is degraded.\n"
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen "Run 'pkg rebuild-index' to improve search speed.")
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainenclass UnsupportedSearchError(SearchException):
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen """Returned when a search protocol is not supported by the
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen remote server."""
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen def __init__(self, url=None, proto=None):
bb86f8f22f2561438ce710d2113f04a4d0082b50Timo Sirainen SearchException.__init__(self)
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen self.url = url
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen self.proto = proto
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen def __str__(self):
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen s = _("Search server does not support the requested protocol:")
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen if self.url:
ab1e5b156d1b5480d36ed6e8e06197339d803038Timo Sirainen s += "\nServer URL: %s" % self.url
ab1e5b156d1b5480d36ed6e8e06197339d803038Timo Sirainen if self.proto:
ab1e5b156d1b5480d36ed6e8e06197339d803038Timo Sirainen s += "\nRequested operation: %s" % self.proto
ab1e5b156d1b5480d36ed6e8e06197339d803038Timo Sirainen return s
ab1e5b156d1b5480d36ed6e8e06197339d803038Timo Sirainen
ab1e5b156d1b5480d36ed6e8e06197339d803038Timo Sirainen def __cmp__(self, other):
ab1e5b156d1b5480d36ed6e8e06197339d803038Timo Sirainen if not isinstance(other, UnsupportedSearchError):
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen return -1
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen r = cmp(self.url, other.url)
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen if r != 0:
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen return r
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen return cmp(self.proto, other.proto)
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen# IndexingExceptions.
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainenclass IndexingException(SearchException):
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen """ The base class for all exceptions that can occur while indexing. """
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen def __init__(self, private_exception):
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen SearchException.__init__(self)
dad1d7b721e80a7e6c0282ace93aef86312fa579Timo Sirainen self.cause = private_exception.cause
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainenclass CorruptedIndexException(IndexingException):
dad1d7b721e80a7e6c0282ace93aef86312fa579Timo Sirainen """This is used when the index is not in a correct state."""
dad1d7b721e80a7e6c0282ace93aef86312fa579Timo Sirainen pass
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
82ed69779f49bd71ef1b570ce8aca67d357dbee8Timo Sirainenclass InconsistentIndexException(IndexingException):
82ed69779f49bd71ef1b570ce8aca67d357dbee8Timo Sirainen """This is used when the existing index is found to have inconsistent
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen versions."""
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen def __init__(self, e):
82ed69779f49bd71ef1b570ce8aca67d357dbee8Timo Sirainen IndexingException.__init__(self, e)
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen self.exception = e
6b85bc4b03e552cfaeeae872d63c2d8ac5fcb7c4Timo Sirainen
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen def __str__(self):
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen return str(self.exception)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainenclass ProblematicPermissionsIndexException(IndexingException):
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen """ This is used when the indexer is unable to create, move, or remove
97144a346898fb62f9fae44fa5c076986553c66bTimo Sirainen files or directories it should be able to. """
97144a346898fb62f9fae44fa5c076986553c66bTimo Sirainen def __str__(self):
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen return "Could not remove or create " \
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen "%s because of incorrect " \
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen "permissions. Please correct this issue then " \
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen "rebuild the index." % self.cause
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen# Query Parsing Exceptions
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainenclass BooleanQueryException(ApiException):
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen """This exception is used when the children of a boolean operation
97144a346898fb62f9fae44fa5c076986553c66bTimo Sirainen have different return types. The command 'pkg search foo AND <bar>'
97144a346898fb62f9fae44fa5c076986553c66bTimo Sirainen is the simplest example of this."""
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen
9bd08aa09ea0cbd7b221aae9fc0534eb762d3de6Timo Sirainen def __init__(self, e):
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen ApiException.__init__(self)
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen self.e = e
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen def __str__(self):
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen return str(self.e)
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen
1e47cfede3a0b62654105daab00e97b5d660bc6bTimo Sirainenclass ParseError(ApiException):
1e47cfede3a0b62654105daab00e97b5d660bc6bTimo Sirainen def __init__(self, e):
1e47cfede3a0b62654105daab00e97b5d660bc6bTimo Sirainen ApiException.__init__(self)
1e47cfede3a0b62654105daab00e97b5d660bc6bTimo Sirainen self.e = e
1e47cfede3a0b62654105daab00e97b5d660bc6bTimo Sirainen
1e47cfede3a0b62654105daab00e97b5d660bc6bTimo Sirainen def __str__(self):
1e47cfede3a0b62654105daab00e97b5d660bc6bTimo Sirainen return str(self.e)
1e47cfede3a0b62654105daab00e97b5d660bc6bTimo Sirainen
1e47cfede3a0b62654105daab00e97b5d660bc6bTimo Sirainen
9af06b76539445d2d84d6e1bcb91685b6abeb4e0Timo Sirainenclass NonLeafPackageException(ApiException):
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen """Removal of a package which satisfies dependencies has been attempted.
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen The first argument to the constructor is the FMRI which we tried to
8ac66221e8fdc2c5523cff1893e0d1c5de25fa49Timo Sirainen remove, and is available as the "fmri" member of the exception. The
8ac66221e8fdc2c5523cff1893e0d1c5de25fa49Timo Sirainen second argument is the list of dependent packages that prevent the
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen removal of the package, and is available as the "dependents" member.
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen """
9af06b76539445d2d84d6e1bcb91685b6abeb4e0Timo Sirainen
9af06b76539445d2d84d6e1bcb91685b6abeb4e0Timo Sirainen def __init__(self, *args):
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen ApiException.__init__(self, *args)
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.fmri = args[0]
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen self.dependents = args[1]
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
de9b2ee7878a73346ba0eee34798abb22ffcfcb6Timo Sirainenclass InvalidDepotResponseException(ApiException):
82ed69779f49bd71ef1b570ce8aca67d357dbee8Timo Sirainen """Raised when the depot doesn't have versions of operations
82ed69779f49bd71ef1b570ce8aca67d357dbee8Timo Sirainen that the client needs to operate successfully."""
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def __init__(self, url, data):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen ApiException.__init__(self)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.url = url
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.data = data
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen def __str__(self):
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen s = "Unable to contact valid package server"
4b231ca0bbe3b536acbd350101e183441ce0247aTimo Sirainen if self.url:
4b231ca0bbe3b536acbd350101e183441ce0247aTimo Sirainen s += ": %s" % self.url
58be9d6bcc3800f5b3d76a064ee767fbe31a5a8aTimo Sirainen if self.data:
4b231ca0bbe3b536acbd350101e183441ce0247aTimo Sirainen s += "\nEncountered the following error(s):\n%s" % \
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen self.data
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen return s
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass DataError(ApiException):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen """Base exception class used for all data related errors."""
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def __init__(self, *args, **kwargs):
5bd1c1d4fe3265d5e6b6054044fd6d78e42c9d0aTimo Sirainen ApiException.__init__(self, *args)
5bd1c1d4fe3265d5e6b6054044fd6d78e42c9d0aTimo Sirainen if args:
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.data = args[0]
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen else:
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.data = None
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.args = kwargs
4f7fea346ca3ab31fc1f421dc179a540663b1450Timo Sirainen
e9594e86dc601b72c1636f2b901dcfbf4ffaf47fAki Tuomi
e9594e86dc601b72c1636f2b901dcfbf4ffaf47fAki Tuomiclass InvalidP5IFile(DataError):
e9594e86dc601b72c1636f2b901dcfbf4ffaf47fAki Tuomi """Used to indicate that the specified location does not contain a
e9594e86dc601b72c1636f2b901dcfbf4ffaf47fAki Tuomi valid p5i-formatted file."""
e9594e86dc601b72c1636f2b901dcfbf4ffaf47fAki Tuomi
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def __str__(self):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen if self.data:
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen return _("The specified file is in an unrecognized "
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen "format or does not contain valid publisher "
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen "information: %s") % self.data
f81801789c71f64a2fc3c44d09f9864bbc68cd45Timo Sirainen return _("The specified file is in an unrecognized format or "
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen "does not contain valid publisher information.")
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainenclass UnsupportedP5IFile(DataError):
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen """Used to indicate that an attempt to read an unsupported version
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen of pkg(5) info file was attempted."""
46d91e9ea8bf41e56c5436c064372171c5876d81Timo Sirainen
46d91e9ea8bf41e56c5436c064372171c5876d81Timo Sirainen def __str__(self):
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen return _("Unsupported pkg(5) publisher information data "
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen "format.")
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainenclass TransportError(ApiException):
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen """Abstract exception class for all transport exceptions.
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen Specific transport exceptions should be implemented in the
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen transport code. Callers wishing to catch transport exceptions
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen should use this class. Subclasses must implement all methods
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen defined here that raise NotImplementedError."""
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
f239eb76f77afcbc0bfc97c9b52b4407d1bc3fe6Timo Sirainen def __str__(self):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen raise NotImplementedError
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass RetrievalError(ApiException):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen """Used to indicate that a a requested resource could not be
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen retrieved."""
f239eb76f77afcbc0bfc97c9b52b4407d1bc3fe6Timo Sirainen
a835194f9a9dae88528367a791cbc282589f6c01Timo Sirainen def __init__(self, data, location=None):
0b878c6a17c608fcd8b52a5762ed2c6a5cf4700aTimo Sirainen ApiException.__init__(self)
678d0463849ba777106eb7875f27db07a5d8e3dfTimo Sirainen self.data = data
678d0463849ba777106eb7875f27db07a5d8e3dfTimo Sirainen self.location = location
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
66ecc94150cbce23aad3240135e0782e0a74d479Timo Sirainen def __str__(self):
66ecc94150cbce23aad3240135e0782e0a74d479Timo Sirainen if self.location:
66ecc94150cbce23aad3240135e0782e0a74d479Timo Sirainen return _("Error encountered while retrieving data from "
66ecc94150cbce23aad3240135e0782e0a74d479Timo Sirainen "'%s':\n%s") % (self.location, self.data)
036626b19f14bef582f96e556913ae91b1d67881Timo Sirainen return _("Error encountered while retrieving data from: %s") % \
036626b19f14bef582f96e556913ae91b1d67881Timo Sirainen self.data
13c6532dc104d23061e6901783ceb1ff8872c206Timo Sirainen
13c6532dc104d23061e6901783ceb1ff8872c206Timo Sirainen
66ecc94150cbce23aad3240135e0782e0a74d479Timo Sirainenclass InvalidResourceLocation(ApiException):
66ecc94150cbce23aad3240135e0782e0a74d479Timo Sirainen """Used to indicate that an invalid transport location was provided."""
17018da24e7dbb419c5047c316caadcb2fc5364aTimo Sirainen
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen def __init__(self, data):
18d92dbbb752c79dc461514e52f7ef11847e636bTimo Sirainen ApiException.__init__(self)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.data = data
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainen
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainen def __str__(self):
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainen return _("'%s' is not a valid location.") % self.data
59151b71059df1190acd75d8717ed04a7920c862Timo Sirainen
59151b71059df1190acd75d8717ed04a7920c862Timo Sirainenclass BEException(ApiException):
da5d50534cfca45d0aaaf0bdac17b287b4588809Timo Sirainen def __init__(self):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen ApiException.__init__(self)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
f239eb76f77afcbc0bfc97c9b52b4407d1bc3fe6Timo Sirainenclass InvalidBENameException(BEException):
f239eb76f77afcbc0bfc97c9b52b4407d1bc3fe6Timo Sirainen def __init__(self, be_name):
f239eb76f77afcbc0bfc97c9b52b4407d1bc3fe6Timo Sirainen BEException.__init__(self)
f239eb76f77afcbc0bfc97c9b52b4407d1bc3fe6Timo Sirainen self.be_name = be_name
f239eb76f77afcbc0bfc97c9b52b4407d1bc3fe6Timo Sirainen
f239eb76f77afcbc0bfc97c9b52b4407d1bc3fe6Timo Sirainen def __str__(self):
f239eb76f77afcbc0bfc97c9b52b4407d1bc3fe6Timo Sirainen return _("'%s' is not a valid boot environment name.") % \
f239eb76f77afcbc0bfc97c9b52b4407d1bc3fe6Timo Sirainen self.be_name
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass DuplicateBEName(BEException):
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainen """Used to indicate that there is an existing boot environment
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainen with this name"""
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainen
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainen def __init__(self, be_name):
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainen BEException.__init__(self)
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen self.be_name = be_name
519e0a461271843833a2b42626ad93f6e7ddc497Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def __str__(self):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen return _("The boot environment '%s' already exists.") % \
122ee3c9e8cf7f51c323204626970c314a32df05Timo Sirainen self.be_name
122ee3c9e8cf7f51c323204626970c314a32df05Timo Sirainen
3ccab0bac68040f179a7de45c516cec258e28fdbTimo Sirainenclass BENamingNotSupported(BEException):
648d24583c1574441c4fa0331a90bd4d6e7996c5Timo Sirainen def __init__(self, be_name):
0cea9b1f4fa0495a48f5f097e40492517d67e1baTimo Sirainen BEException.__init__(self)
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen self.be_name = be_name
0cea9b1f4fa0495a48f5f097e40492517d67e1baTimo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def __str__(self):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen return _("""\
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenBoot environment naming during package install is not supported on this
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenversion of OpenSolaris. Please image-update without the --be-name option.""")
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen
2af769daebd83719ac696a440e06f6020471cec0Timo Sirainenclass UnableToCopyBE(BEException):
036626b19f14bef582f96e556913ae91b1d67881Timo Sirainen def __str__(self):
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen return _("Unable to clone the current boot environment.")
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen
763f83d3cc47bce05cbc396419c4db2b71dd8e68Timo Sirainenclass UnableToRenameBE(BEException):
763f83d3cc47bce05cbc396419c4db2b71dd8e68Timo Sirainen def __init__(self, orig, dest):
763f83d3cc47bce05cbc396419c4db2b71dd8e68Timo Sirainen BEException.__init__(self)
763f83d3cc47bce05cbc396419c4db2b71dd8e68Timo Sirainen self.original_name = orig
763f83d3cc47bce05cbc396419c4db2b71dd8e68Timo Sirainen self.destination_name = dest
763f83d3cc47bce05cbc396419c4db2b71dd8e68Timo Sirainen
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen def __str__(self):
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen d = {
036626b19f14bef582f96e556913ae91b1d67881Timo Sirainen "orig": self.original_name,
036626b19f14bef582f96e556913ae91b1d67881Timo Sirainen "dest": self.destination_name
036626b19f14bef582f96e556913ae91b1d67881Timo Sirainen }
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen return _("""\
51b979b6414b940f04677a7e2d064be119345954Timo SirainenA problem occurred while attempting to rename the boot environment
036626b19f14bef582f96e556913ae91b1d67881Timo Sirainencurrently named %(orig)s to %(dest)s.""") % d
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainenclass UnableToMountBE(BEException):
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen def __init__(self, be_name, be_dir):
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen BEException.__init__(self)
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen self.name = be_name
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen self.mountpoint = be_dir
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen def __str__(self):
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen return _("Unable to mount %(name)s at %(mt)s") % \
4aae8acbcfa9cac96b4af39bfabcbe569e804827Timo Sirainen {"name": self.name, "mt": self.mountpoint}
5bdad39213d28ab35e615a7f4ea1712ab25b6a80Timo Sirainen
5bdad39213d28ab35e615a7f4ea1712ab25b6a80Timo Sirainenclass BENameGivenOnDeadBE(BEException):
5bdad39213d28ab35e615a7f4ea1712ab25b6a80Timo Sirainen def __init__(self, be_name):
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen BEException.__init__(self)
763f83d3cc47bce05cbc396419c4db2b71dd8e68Timo Sirainen self.name = be_name
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen
4aae8acbcfa9cac96b4af39bfabcbe569e804827Timo Sirainen def __str__(self):
4aae8acbcfa9cac96b4af39bfabcbe569e804827Timo Sirainen return _("""\
4aae8acbcfa9cac96b4af39bfabcbe569e804827Timo SirainenNaming a boot environment when operating on a non-live image is
51b979b6414b940f04677a7e2d064be119345954Timo Sirainennot allowed.""")
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainenclass UnrecognizedOptionsToInfo(ApiException):
bc564f1d3d953cf724828322b11ae89e0f59ffc9Timo Sirainen def __init__(self, opts):
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen ApiException.__init__(self)
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen self._opts = opts
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen def __str__(self):
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen s = _("Info does not recognize the following options:")
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen for o in self._opts:
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen s += _(" '") + str(o) + _("'")
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen return s
6cb2c6ecddcdbeac9e6c73a292244747e12a793eTimo Sirainen
2af769daebd83719ac696a440e06f6020471cec0Timo Sirainenclass IncorrectIndexFileHash(ApiException):
2af769daebd83719ac696a440e06f6020471cec0Timo Sirainen """This is used when the index hash value doesn't match the hash of the
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen packages installed in the image."""
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen pass
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainen
82ed69779f49bd71ef1b570ce8aca67d357dbee8Timo Sirainenclass PublisherError(ApiException):
df6478c4cf605bd81b3891c148b84c14eb6c4035Timo Sirainen """Base exception class for all publisher exceptions."""
df6478c4cf605bd81b3891c148b84c14eb6c4035Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen def __init__(self, *args, **kwargs):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen ApiException.__init__(self, *args)
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen if args:
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen self.data = args[0]
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen else:
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen self.data = None
6a8a4c9f530668cd8961b73d702856ed94f05f80Timo Sirainen self.args = kwargs
0d0451206a91e9f96e522075dce28a89adc2325dTimo Sirainen
1c0590b2729567ad60dafde4d2c5f19635755a3dTimo Sirainen def __str__(self):
1c0590b2729567ad60dafde4d2c5f19635755a3dTimo Sirainen return str(self.data)
ba482d3624ca4f1b3d638e6e8470ba5134f21493Timo Sirainen
ba482d3624ca4f1b3d638e6e8470ba5134f21493Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainenclass BadPublisherMetaRoot(PublisherError):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen """Used to indicate an operation on the publisher's meta_root failed
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen because the meta_root is invalid."""
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen def __str__(self):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen return _("Publisher meta_root '%(root)s' is invalid; unable "
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen "to complete operation: '%(op)s'.") % { "root": self.data,
84da9c6d6e162b064608cbfa9a47e0d60553c593Timo Sirainen "op": self.args.get("operation", None) }
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainenclass BadPublisherPrefix(PublisherError):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen """Used to indicate that a publisher name is not valid."""
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
fd2f5fbc1f07aa93e2214a28cdf02437fb7d06c8Timo Sirainen def __str__(self):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen return _("'%s' is not a valid publisher name.") % self.data
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainenclass BadRepositoryAttributeValue(PublisherError):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen """Used to indicate that the specified repository attribute value is
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen invalid."""
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen def __str__(self):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen return _("'%(value)s' is not a valid value for repository "
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen "attribute '%(attribute)s'.") % {
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen "value": self.args["value"], "attribute": self.data }
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
425cbcea60cf689b0069698c83f8bdc474d70693Timo Sirainenclass BadRepositoryCollectionType(PublisherError):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen """Used to indicate that the specified repository collection type is
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen invalid."""
114a0f74e0f825c6bd8aeadfafb248a030762a1fTimo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen def __init__(self, *args, **kwargs):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen PublisherError.__init__(self, *args, **kwargs)
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
6fdf8b5e4e71a69f5974f59eec2b8c19bc421fe2Timo Sirainen def __str__(self):
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen return _("'%s' is not a valid repository collection type.") % \
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen self.data
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainenclass BadRepositoryURI(PublisherError):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen """Used to indicate that a repository URI is not syntactically valid."""
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen def __str__(self):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen return _("'%s' is not a valid URI.") % self.data
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainenclass BadRepositoryURIPriority(PublisherError):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen """Used to indicate that the priority specified for a repository URI is
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen not valid."""
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen def __str__(self):
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen return _("'%s' is not a valid URI priority; integer value "
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen "expected.") % self.data
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainenclass BadRepositoryURISortPolicy(PublisherError):
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen """Used to indicate that the specified repository URI sort policy is
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen invalid."""
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen def __init__(self, *args, **kwargs):
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen PublisherError.__init__(self, *args, **kwargs)
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen
ab70f55bb8d824ca1ed7c74196f2f502edd29cc7Timo Sirainen def __str__(self):
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen return _("'%s' is not a valid repository URI sort policy.") % \
d0bbbc7057aa33b52ee378196dee7d773437468fTimo Sirainen self.data
a817fdcc43aedf423e2134091d5f83f91d64bcc9Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
a817fdcc43aedf423e2134091d5f83f91d64bcc9Timo Sirainenclass DisabledPublisher(PublisherError):
a817fdcc43aedf423e2134091d5f83f91d64bcc9Timo Sirainen """Used to indicate that an attempt to use a disabled publisher occurred
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen during an operation."""
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen
4bbee99b3aef449a9a2a11a5b5cf1ca486915c49Timo Sirainen def __str__(self):
a817fdcc43aedf423e2134091d5f83f91d64bcc9Timo Sirainen return _("Publisher '%s' is disabled and cannot be used for "
4bbee99b3aef449a9a2a11a5b5cf1ca486915c49Timo Sirainen "packaging operations.") % self.data
62cfc346eb7b0a4fd9e1ab6edd63b98711161229Timo Sirainen
62cfc346eb7b0a4fd9e1ab6edd63b98711161229Timo Sirainen
62cfc346eb7b0a4fd9e1ab6edd63b98711161229Timo Sirainenclass DuplicatePublisher(PublisherError):
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen """Used to indicate that a publisher with the same name or alias already
a817fdcc43aedf423e2134091d5f83f91d64bcc9Timo Sirainen exists for an image."""
62cfc346eb7b0a4fd9e1ab6edd63b98711161229Timo Sirainen
62cfc346eb7b0a4fd9e1ab6edd63b98711161229Timo Sirainen def __str__(self):
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen return _("A publisher with the same name or alias as '%s' "
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen "already exists.") % self.data
a817fdcc43aedf423e2134091d5f83f91d64bcc9Timo Sirainen
a817fdcc43aedf423e2134091d5f83f91d64bcc9Timo Sirainen
a817fdcc43aedf423e2134091d5f83f91d64bcc9Timo Sirainenclass DuplicateRepository(PublisherError):
f501ad38c51cf1d8f4f84313922c785e6ae6e81fTimo Sirainen """Used to indicate that a repository with the same origin uris
1098fc409a45e7603701dc94635927a673bee0c1Timo Sirainen already exists for a publisher."""
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen
72cbf33ae81fde08384d30c779ff540752d9256cTimo Sirainen def __str__(self):
b780aa272b742a43579cdb523cc79cc8d4521306Timo Sirainen return _("A repository with the same name or origin URIs "
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen "already exists for publisher '%s'.") % self.data
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen
51b979b6414b940f04677a7e2d064be119345954Timo Sirainenclass DuplicateRepositoryMirror(PublisherError):
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen """Used to indicate that a repository URI is already in use by another
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen repository mirror."""
a817fdcc43aedf423e2134091d5f83f91d64bcc9Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def __str__(self):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen return _("Mirror '%s' already exists for the specified "
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen "repository.") % self.data
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainenclass DuplicateRepositoryOrigin(PublisherError):
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen """Used to indicate that a repository URI is already in use by another
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen repository origin."""
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen def __str__(self):
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen return _("Origin '%s' already exists for the specified "
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen "repository.") % self.data
8ac66221e8fdc2c5523cff1893e0d1c5de25fa49Timo Sirainen
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen
bba52ecbb0cfb6585f1a4ff29695dd2d27af98d2Timo Sirainenclass RemovePreferredPublisher(PublisherError):
bba52ecbb0cfb6585f1a4ff29695dd2d27af98d2Timo Sirainen """Used to indicate an attempt to remove the preferred publisher was
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen made."""
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen
dbd9604da561399cc6255289d5b6f6f662ab2d00Timo Sirainen def __str__(self):
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen return _("The preferred publisher cannot be removed.")
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainen
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainenclass SelectedRepositoryRemoval(PublisherError):
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen """Used to indicate that an attempt to remove the selected repository
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainen for a publisher was made."""
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainen
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainen def __str__(self):
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainen return _("Cannot remove the selected repository for a "
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainen "publisher.")
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainen
044b0557e92ae0bb3b25af49d5468bad3d17db43Timo Sirainen
044b0557e92ae0bb3b25af49d5468bad3d17db43Timo Sirainenclass SetPreferredPublisherDisabled(PublisherError):
044b0557e92ae0bb3b25af49d5468bad3d17db43Timo Sirainen """Used to indicate an attempt to set a disabled publisher as the
044b0557e92ae0bb3b25af49d5468bad3d17db43Timo Sirainen preferred publisher was made."""
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainen
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen def __str__(self):
044b0557e92ae0bb3b25af49d5468bad3d17db43Timo Sirainen return _("Publisher '%s' is disabled and cannot be set as the "
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen "preferred publisher.") % self.data
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainenclass UnknownLegalURI(PublisherError):
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen """Used to indicate that no matching legal URI could be found using the
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen provided criteria."""
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen def __str__(self):
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen return _("Unknown legal URI '%s'.") % self.data
131b073bdc3650083b00616dc778dd3017c2bbb5Timo Sirainen
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainenclass UnknownPublisher(PublisherError):
289064eb21595d3e4460439eccdc48232d13f5e1Timo Sirainen """Used to indicate that no matching publisher could be found using the
f3976df875193529127d584cb713983e8160bdcfTimo Sirainen provided criteria."""
f3976df875193529127d584cb713983e8160bdcfTimo Sirainen
f3976df875193529127d584cb713983e8160bdcfTimo Sirainen def __str__(self):
f3976df875193529127d584cb713983e8160bdcfTimo Sirainen return _("Unknown publisher '%s'.") % self.data
f3976df875193529127d584cb713983e8160bdcfTimo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenclass UnknownRelatedURI(PublisherError):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen """Used to indicate that no matching related URI could be found using
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen the provided criteria."""
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def __str__(self):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen return _("Unknown related URI '%s'.") % self.data
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenclass UnknownRepository(PublisherError):
4b058f90f9e8a2c6b2eed275de4eb8cc5195a71dTimo Sirainen """Used to indicate that no matching repository could be found using the
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen provided criteria."""
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen def __str__(self):
128ea07dab8d67124ea74bcc085a478784b6358aTimo Sirainen return _("Unknown repository '%s'.") % self.data
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
128ea07dab8d67124ea74bcc085a478784b6358aTimo Sirainen
128ea07dab8d67124ea74bcc085a478784b6358aTimo Sirainenclass UnknownRepositoryMirror(PublisherError):
6f73af3a3a6ee900c7e736874587968d76a20bc0Timo Sirainen """Used to indicate that a repository URI could not be found in the
6f73af3a3a6ee900c7e736874587968d76a20bc0Timo Sirainen list of repository mirrors."""
128ea07dab8d67124ea74bcc085a478784b6358aTimo Sirainen
5724e7103eed12fe36b55a7b5a8653284a2184b9Timo Sirainen def __str__(self):
5724e7103eed12fe36b55a7b5a8653284a2184b9Timo Sirainen return _("Unknown repository mirror '%s'.") % self.data
4bbee99b3aef449a9a2a11a5b5cf1ca486915c49Timo Sirainen
4bbee99b3aef449a9a2a11a5b5cf1ca486915c49Timo Sirainen
0f66f12eb4cdbf47670975044c88d8f388bf92dfTimo Sirainenclass UnknownRepositoryOrigin(PublisherError):
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen """Used to indicate that a repository URI could not be found in the
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen list of repository origins."""
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen
8fa86f7ef06aa6cf0239c7ca2eb98889691d40d4Timo Sirainen def __str__(self):
8fa86f7ef06aa6cf0239c7ca2eb98889691d40d4Timo Sirainen return _("Unknown repository origin '%s'") % self.data
8fa86f7ef06aa6cf0239c7ca2eb98889691d40d4Timo Sirainen
8fa86f7ef06aa6cf0239c7ca2eb98889691d40d4Timo Sirainen
8fa86f7ef06aa6cf0239c7ca2eb98889691d40d4Timo Sirainenclass UnsupportedRepositoryURI(PublisherError):
8fa86f7ef06aa6cf0239c7ca2eb98889691d40d4Timo Sirainen """Used to indicate that the specified repository URI uses an
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen unsupported scheme."""
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen def __str__(self):
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen if self.data:
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen scheme = urlparse.urlsplit(self.data,
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen allow_fragments=0)[0]
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen return _("The URI '%(uri)s' contains an unsupported "
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen "scheme '%(scheme)s'.") % { "uri": self.data,
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen "scheme": scheme }
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen return _("The specified URI contains an unsupported scheme.")
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainenclass UnsupportedRepositoryURIAttribute(PublisherError):
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen """Used to indicate that the specified repository URI attribute is not
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen supported for the URI's scheme."""
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen
956f7778e413d3184d69e7b96e4a6b3cd5570bcdTimo Sirainen def __str__(self):
return _("'%(attr)s' is not supported for '%(scheme)s'.") % {
"attr": self.data, "scheme": self.args["scheme"] }
class CertificateError(ApiException):
"""Base exception class for all certificate exceptions."""
def __init__(self, *args, **kwargs):
ApiException.__init__(self, *args)
if args:
self.data = args[0]
else:
self.data = None
self.args = kwargs
def __str__(self):
return str(self.data)
class ExpiredCertificate(CertificateError):
"""Used to indicate that a certificate has expired."""
def __str__(self):
publisher = self.args.get("publisher", None)
uri = self.args.get("uri", None)
if publisher:
if uri:
return _("Certificate '%(cert)s' for publisher "
"'%(pub)s' needed to access '%(uri)s', "
"has expired. Please install a valid "
"certificate.") % { "cert": self.data,
"pub": publisher, "uri": uri }
return _("Certificate '%(cert)s' for publisher "
"'%(pub)s', has expired. Please install a valid "
"certificate.") % { "cert": self.data,
"pub": publisher }
if uri:
return _("Certificate '%(cert)s', needed to access "
"'%(uri)s', has expired. Please install a valid "
"certificate.") % { "cert": self.data, "uri": uri }
return _("Certificate '%s' has expired. Please install a "
"valid certificate.") % self.data
class ExpiringCertificate(CertificateError):
"""Used to indicate that a certificate has expired."""
def __str__(self):
publisher = self.args.get("publisher", None)
uri = self.args.get("uri", None)
days = self.args.get("days", 0)
if publisher:
if uri:
return _("Certificate '%(cert)s' for publisher "
"'%(pub)s', needed to access '%(uri)s', "
"will expire in '%(days)s' days.") % {
"cert": self.data, "pub": publisher,
"uri": uri, "days": days }
return _("Certificate '%(cert)s' for publisher "
"'%(pub)s' will expire in '%(days)s' days.") % {
"cert": self.data, "pub": publisher, "days": days }
if uri:
return _("Certificate '%(cert)s', needed to access "
"'%(uri)s', will expire in '%(days)s' days.") % {
"cert": self.data, "uri": uri, "days": days }
return _("Certificate '%(cert)s' will expire in "
"'%(days)s' days.") % { "cert": self.data, "days": days }
class InvalidCertificate(CertificateError):
"""Used to indicate that a certificate is invalid."""
def __str__(self):
publisher = self.args.get("publisher", None)
uri = self.args.get("uri", None)
if publisher:
if uri:
return _("Certificate '%(cert)s' for publisher "
"'%(pub)s', needed to access '%(uri)s', is "
"invalid.") % { "cert": self.data,
"pub": publisher, "uri": uri }
return _("Certificate '%(cert)s' for publisher "
"'%(pub)s' is invalid.") % { "cert": self.data,
"pub": publisher }
if uri:
return _("Certificate '%(cert)s' needed to access "
"'%(uri)s' is invalid.") % { "cert": self.data,
"uri": uri }
return _("Invalid certificate '%s'.") % self.data
class NoSuchCertificate(CertificateError):
"""Used to indicate that a certificate could not be found."""
def __str__(self):
publisher = self.args.get("publisher", None)
uri = self.args.get("uri", None)
if publisher:
if uri:
return _("Unable to locate certificate "
"'%(cert)s' for publisher '%(pub)s' needed "
"to access '%(uri)s'.") % {
"cert": self.data, "pub": publisher,
"uri": uri }
return _("Unable to locate certificate '%(cert)s' for "
"publisher '%(pub)s'.") % { "cert": self.data,
"pub": publisher }
if uri:
return _("Unable to locate certificate '%(cert)s' "
"needed to access '%(uri)s'.") % {
"cert": self.data, "uri": uri }
return _("Unable to locate certificate '%s'.") % self.data
class NotYetValidCertificate(CertificateError):
"""Used to indicate that a certificate is not yet valid (future
effective date)."""
def __str__(self):
publisher = self.args.get("publisher", None)
uri = self.args.get("uri", None)
if publisher:
if uri:
return _("Certificate '%(cert)s' for publisher "
"'%(pub)s', needed to access '%(uri)s', "
"has a future effective date.") % {
"cert": self.data, "pub": publisher,
"uri": uri }
return _("Certificate '%(cert)s' for publisher "
"'%(pub)s' has a future effective date.") % {
"cert": self.data, "pub": publisher }
if uri:
return _("Certificate '%(cert)s' needed to access "
"'%(uri)s' has a future effective date.") % {
"cert": self.data, "uri": uri }
return _("Certificate '%s' has a future effective date.") % \
self.data
class ServerReturnError(ApiException):
"""This exception is used when the server reutrns a line which the
client cannot parse correctly."""
def __init__(self, line):
ApiException.__init__(self)
self.line = line
def __str__(self):
return _("Gave a bad response:%s") % self.line