api_errors.py revision 1335
# See the License for the specific language governing permissions # and limitations under the License. # When distributing Covered Code, include this CDDL HEADER in each # 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] # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # EmptyI for argument defaults; can't import from misc due to circular """Used when an image was not found""" return _(
"Could not operate on %s\nbecause of " "insufficient permissions. Please try the command " "again using pfexec\nor otherwise increase your " Could not complete the operation because of insufficient permissions. Please try the command again using pfexec or otherwise increase your privileges. return _(
"Could not operate on %s\nbecause the file is " "in use. Please stop using the file and try the\n" """Used to indicate that the operation was attempted on a return _(
"Could not complete the operation on %s: " return _(
"Could not complete the operation: read-only " The following pattern(s) did not match any packages in the current catalog. Try relaxing the pattern, refreshing and/or examining the catalogs:""")
s = _(
"'%s' matches multiple packages")
s = _(
"'%s' matches no installed packages")
s = _(
"'%s' is an illegal fmri")
s = _(
"The following package(s) violated constraints:")
s = _(
"'%s' supports the following architectures: %s")
a = _(
"Image architecture is defined as: %s")
"""An error was encountered executing an action. In particular, this exception indicates that something went wrong in the application (or unapplication) of the action to the system, not an error The 'msg' argument can provide a more specific message than what would be returned from, and 'ignoreerrno' can be set to True to indicate that the sterror() text is misleading, and shouldn't be displayed. # Fall back on the wrapped exception if we don't have anything # If we only have one of the two, no need for the colon. """Base class used for all catalog cache errors.""" """Used to indicate that the catalog cache is invalid or is not of a return _(
"Unsupported catalog cache Version: '%(found)s'; " "expected: '%(expected)s'") % {
"found":
self.
data,
"""Used to indicate that the catalog cache is corrupt or otherwise return _(
"Catalog cache is corrupt or invalid; error " "encountered while reading:\nline %(lnum)d: '%(data)s'") % {
"""Used to indicate that the catalog cache is missing.""" return _(
"Catalog cache is missing.")
# Illegal FMRIs have their own __str__ method outstr += _(
"No matching package could be found for " "the following FMRIs in any of the catalogs for " "the current publishers:\n")
"""Based class used for all search-related api exceptions.""" """This is used when the main dictionary could not parse a line.""" """Raised when the server cannot understand the format of the """Returned when the search cannot find any matches.""" return _(
"The search at url %s returned no results.") %
self.
url """This class wraps exceptions which could appear while trying to s = _(
"Some servers failed to respond appropriately:\n")
s += _(
"%(o)s:\n%(msg)s\n") % \
s += _(
"%s did not return a valid response.\n" \
s += _(
"Some servers don't support requested search" s += _(
"%(o)s:\n%(msg)s\n") % \
"""This exception is thrown when a local search is performed without an index. It's raised after all results have been yielded.""" return _(
"Search performance is degraded.\n" "Run 'pkg rebuild-index' to improve search speed.")
"""Returned when a search protocol is not supported by the s = _(
"Search server does not support the requested protocol:")
s +=
"\nRequested operation: %s" %
self.
proto """ The base class for all exceptions that can occur while indexing. """ """This is used when the index is not in a correct state.""" """This is used when the existing index is found to have inconsistent """ 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 " \
"""This exception is used to wrap an indexing exception during install, uninstall, or image-update so that a more appropriate error message can be displayed to the user.""" """This exception is used to wrap an indexing exception during install, uninstall, or image-update which was recovered from by performing a # Query Parsing Exceptions """This exception is used when the children of a boolean operation have different return types. The command 'pkg search foo AND <bar>' is the simplest example of this.""" """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" % \
"""Base exception class used for all data related errors.""" """Used to indicate that the specified location does not contain a valid p5i-formatted file.""" return _(
"The specified file is in an unrecognized " "format or does not contain valid publisher " return _(
"The specified file is in an unrecognized format or " "does not contain valid publisher information.")
"""Used to indicate that an attempt to read an unsupported version of pkg(5) info file was attempted.""" return _(
"Unsupported pkg(5) publisher information data " """Abstract exception class for all transport exceptions. Specific transport exceptions should be implemented in the transport code. Callers wishing to catch transport exceptions should use this class. Subclasses must implement all methods defined here that raise NotImplementedError.""" """Used to indicate that a a requested resource could not be return _(
"Error encountered while retrieving data from " return _(
"Error encountered while retrieving data from: %s") % \
"""Used to indicate that an invalid transport location was provided.""" return _(
"'%s' is not a valid location.") %
self.
data return _(
"'%s' is not a valid boot environment name.") % \
"""Used to indicate that there is an existing boot environment return _(
"The boot environment '%s' already exists.") % \
Boot environment naming during package install is not supported on this version of OpenSolaris. Please image-update without the --be-name option.""")
return _(
"Unable to clone the current boot environment.")
A problem occurred while attempting to rename the boot environment currently named %(orig)s to %(dest)s.""") % d
return _(
"Unable to mount %(name)s at %(mt)s") % \
Naming a boot environment when operating on a non-live image is s = _(
"Info does not recognize the following options:")
s += _(
" '") +
str(o) + _(
"'")
"""This is used when the index hash value doesn't match the hash of the packages installed in the image.""" """Base exception class for all publisher exceptions.""" """Used to indicate an operation on the publisher's meta_root failed because the meta_root is invalid.""" return _(
"Publisher meta_root '%(root)s' is invalid; unable " "to complete operation: '%(op)s'.") % {
"root":
self.
data,
"""Used to indicate that a publisher name is not valid.""" return _(
"'%s' is not a valid publisher name.") %
self.
data """Used to indicate that the specified repository attribute value is return _(
"'%(value)s' is not a valid value for repository " "attribute '%(attribute)s'.") % {
"""Used to indicate that the specified repository collection type is return _(
"'%s' is not a valid repository collection type.") % \
"""Used to indicate that a repository URI is not syntactically valid.""" return _(
"'%s' is not a valid URI.") %
self.
data """Used to indicate that the priority specified for a repository URI is return _(
"'%s' is not a valid URI priority; integer value " """Used to indicate that the specified repository URI sort policy is return _(
"'%s' is not a valid repository URI sort policy.") % \
"""Used to indicate that an attempt to use a disabled publisher occurred return _(
"Publisher '%s' is disabled and cannot be used for " """Used to indicate that a publisher with the same name or alias already return _(
"A publisher with the same name or alias as '%s' " """Used to indicate that a repository with the same origin uris already exists for a publisher.""" return _(
"A repository with the same name or origin URIs " "already exists for publisher '%s'.") %
self.
data """Used to indicate that a repository URI is already in use by another return _(
"Mirror '%s' already exists for the specified " """Used to indicate that a repository URI is already in use by another return _(
"Origin '%s' already exists for the specified " """Used to indicate an attempt to remove the preferred publisher was return _(
"The preferred publisher cannot be removed.")
"""Used to indicate that an attempt to remove the selected repository for a publisher was made.""" return _(
"Cannot remove the selected repository for a " """Used to indicate an attempt to set a disabled publisher as the preferred publisher was made.""" return _(
"Publisher '%s' is disabled and cannot be set as the " """Used to indicate that an attempt was made to set the preferred publisher as disabled.""" return _(
"The preferred publisher may not be disabled." " Another publisher must be set as the preferred " "publisher before this publisher can be disabled.")
"""Used to indicate that no matching legal URI could be found using the return _(
"Unknown legal URI '%s'.") %
self.
data """Used to indicate that no matching publisher could be found using the return _(
"Unknown publisher '%s'.") %
self.
data """Used to indicate that no matching related URI could be found using the provided criteria.""" return _(
"Unknown related URI '%s'.") %
self.
data """Used to indicate that no matching repository could be found using the return _(
"Unknown repository '%s'.") %
self.
data """Used to indicate that a repository URI could not be found in the list of repository mirrors.""" return _(
"Unknown repository mirror '%s'.") %
self.
data """Used to indicate that a repository URI could not be found in the list of repository origins.""" return _(
"Unknown repository origin '%s'") %
self.
data """Used to indicate that the specified repository URI uses an return _(
"The URI '%(uri)s' contains an unsupported " "scheme '%(scheme)s'.") % {
"uri":
self.
data,
return _(
"The specified URI contains an unsupported scheme.")
"""Used to indicate that the specified repository URI attribute is not supported for the URI's scheme.""" return _(
"'%(attr)s' is not supported for '%(scheme)s'.") % {
"""Base exception class for all certificate exceptions.""" """Used to indicate that a certificate has expired.""" return _(
"Certificate '%(cert)s' for publisher " "'%(pub)s' needed to access '%(uri)s', " "has expired. Please install a valid " return _(
"Certificate '%(cert)s' for publisher " "'%(pub)s', has expired. Please install a valid " return _(
"Certificate '%(cert)s', needed to access " "'%(uri)s', has expired. Please install a valid " return _(
"Certificate '%s' has expired. Please install a " """Used to indicate that a certificate has expired.""" return _(
"Certificate '%(cert)s' for publisher " "'%(pub)s', needed to access '%(uri)s', " "will expire in '%(days)s' days.") % {
return _(
"Certificate '%(cert)s' for publisher " "'%(pub)s' will expire in '%(days)s' days.") % {
return _(
"Certificate '%(cert)s', needed to access " "'%(uri)s', will expire in '%(days)s' days.") % {
return _(
"Certificate '%(cert)s' will expire in " """Used to indicate that a certificate is invalid.""" return _(
"Certificate '%(cert)s' for publisher " "'%(pub)s', needed to access '%(uri)s', is " return _(
"Certificate '%(cert)s' for publisher " "'%(pub)s' is invalid.") % {
"cert":
self.
data,
return _(
"Certificate '%(cert)s' needed to access " "'%(uri)s' is invalid.") % {
"cert":
self.
data,
return _(
"Invalid certificate '%s'.") %
self.
data """Used to indicate that a key could not be found.""" return _(
"Unable to locate key '%(key)s' for " "publisher '%(pub)s' needed to access " return _(
"Unable to locate key '%(key)s' for publisher " return _(
"Unable to locate key '%(key)s' needed to " "access '%(uri)s'.") % {
"key":
self.
data,
return _(
"Unable to locate key '%s'.") %
self.
data """Used to indicate that a certificate could not be found.""" return _(
"Unable to locate certificate " "'%(cert)s' for publisher '%(pub)s' needed " "to access '%(uri)s'.") % {
return _(
"Unable to locate certificate '%(cert)s' for " "publisher '%(pub)s'.") % {
"cert":
self.
data,
return _(
"Unable to locate certificate '%(cert)s' " "needed to access '%(uri)s'.") % {
return _(
"Unable to locate certificate '%s'.") %
self.
data """Used to indicate that a certificate is not yet valid (future return _(
"Certificate '%(cert)s' for publisher " "'%(pub)s', needed to access '%(uri)s', " "has a future effective date.") % {
return _(
"Certificate '%(cert)s' for publisher " "'%(pub)s' has a future effective date.") % {
return _(
"Certificate '%(cert)s' needed to access " "'%(uri)s' has a future effective date.") % {
return _(
"Certificate '%s' has a future effective date.") % \
"""This exception is used when the server reutrns a line which the client cannot parse correctly.""" return _(
"Gave a bad response:%s") %
self.
line