api_errors.py revision 2126
"""Used to indicate that the image plan is no longer valid, likely as a result of an image state change since the plan was created.""" return _(
"The plan for the current operation is no longer " "valid. The image has likely been modified by another " "process or client. Please try the operation again.")
return _(
"Invalid package state change attempted '%(states)s' " "for package '%(fmri)s'.") % {
"states":
self.
states,
return _(
"Could not operate on %s\nbecause of " "insufficient permissions. Please try the " "command again as a privileged user.") % \
Could not complete the operation because of insufficient permissions. Please try the command again as a privileged user. 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 = _(
"The following patterns only matched packages " "that are from publishers other than that which " "supplied the already installed version of this package")
s = _(
"'%s' matches multiple packages")
s = _(
"'%s' matches no installed packages")
s = _(
"'%s' is an illegal fmri")
s = _(
"'%s' supports the following architectures: %s")
a = _(
"Image architecture is defined as: %s")
s = _(
"'%(p)s' depends on obsolete package '%(op)s'")
s = _(
"The proposed operation can not be performed for " "the following package(s) as they are already " s = _(
"The following different patterns specify the" res += [_(
"No solution was found to satisfy constraints")]
res += [_(
"Package %(pkg)s is missing a dependency: " """Used to indicate that action execution (such as install, remove, etc.) failed even though the action is valid. In particular, this exception indicates that something went wrong in the application (or unapplication) of the action to the system, and is most likely not an error in the pkg(5) code.""" """'action' is the object for the action that failed during the 'details' is an optional message explaining what operation failed, why it failed, and why it cannot continue. It should also include a suggestion as to how to resolve the situation 'error' is an optional exception object that may have been raised when the operation failed. 'fmri' is an optional package FMRI indicating what package was being operated on at the time the error occurred. 'use_errno' is an optional boolean value indicating whether the strerror() text of the exception should be used. If 'details' is provided, the default value is False, otherwise # If details were provided, don't use errno unless # Fall back on the wrapped exception if we don't have anything details = _(
"Requested operation failed for action " "%(action)s:\n%(details)s") % {
details = _(
"Requested operation failed for package " "%(fmri)s:\n%(details)s") % {
"fmri":
self.
fmri,
# If we only have one of the two, no need for the colon. """Base exception class for all catalog exceptions.""" """Used to indicate that the specified FMRI is not valid for catalog operations because it is missing publisher information.""" return _(
"The FMRI '%s' does not contain publisher information " "and cannot be used for catalog operations.") %
self.
data """Used to indicate an operation on the catalog's meta_root failed because the meta_root is invalid.""" return _(
"Catalog meta_root '%(root)s' is invalid; unable " "to complete operation: '%(op)s'.") % {
"root":
self.
data,
"""Used to indicate the server catalog files do not have the expected """files should contain a list object with each entry consisting of a tuple of filename, expected_mode, received_mode.""" msg = _(
"The following catalog files have incorrect " msg += _(
"\t%(fname)s: expected mode: %(emode)s, found " "mode: %(fmode)s\n") % {
"fname":
fname,
"""Used to indicate that the Catalog signatures are not valid.""" return _(
"The signature data for the '%s' catalog file is not " """Used to indicate that the requested catalog updates could not be applied as the new catalog data is significantly different such that the old catalog cannot be updated to match it.""" return _(
"Unable to determine the updates needed for " "the current catalog using the provided catalog " """Used to indicate that the specified catalog operation could not be performed since it would result in a duplicate catalog entry.""" return _(
"Unable to perform '%(op)s' operation for catalog " "%(name)s; completion would result in a duplicate entry " """Used to indicate that an update request for the catalog could not be performed because update requirements were not satisfied.""" return _(
"Catalog updates can only be applied to an on-disk " """Used to indicate a Catalog file could not be loaded.""" return _(
"Catalog file '%s' is invalid.") %
self.
data """Used to indicate that a Catalog's attributes and parts do not match. This is likely the result of an attributes file being retrieved which doesn't match the parts that were retrieved such as in a misconfigured or stale cache case.""" return _(
"The content of the catalog for publisher '%s' " "doesn't match the catalog's attributes. This is " "likely the result of a mix of older and newer " "catalog files being provided for the publisher.") % \
"""Used to indicate that the specified catalog updates are for an older version of the catalog and cannot be applied.""" return _(
"Unable to determine the updates needed for the " "catalog using the provided catalog update data in '%s'. " "The specified catalog updates are for an older version " "of the catalog and cannot be used.") %
self.
data """Used to indicate that an entry for the specified package FMRI or pattern could not be found in the catalog.""" return _(
"'%s' could not be found in the catalog.") %
self.
data """Used to indicate that the specified CatalogUpdate operation is return _(
"Unknown catalog update type '%s'") %
self.
data """Raised when the catalog finds a CatalogPart that is unrecognized return _(
"Unrecognized, unknown, or invalid CatalogPart '%s'") \
"""Used to indicate that some of the specified patterns to a catalog matching function did not match any catalog entries, or were invalid # 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")
outstr += _(
"%s (pattern did not match)\n") % x
outstr += _(
"%s (publisher did not " outstr += _(
"%s (version did not match)\n") % x
"""Based class used for all search-related api exceptions.""" """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 repositories failed to respond appropriately:\n")
s += _(
"%(o)s:\n%(msg)s\n") % \
s += _(
"%s did not return a valid response.\n" \
s += _(
"Some repositories don't support requested " 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 repository does not support the requested " s +=
"\nRepository URL: %s" %
self.
url 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 an attempt to modify an index locked by another process or thread is made.""" """ 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 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 update which was recovered from by performing a full # 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 repository" 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 provided p5i data is in an unrecognized " "format or does not contain valid publisher " return _(
"The provided p5i data 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 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 alias is not valid.""" return _(
"'%s' is not a valid publisher alias.") %
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 that the specified publisher must have at least one repository with at least one origin URI.""" return _(
"At least one origin is required for %s. You must " "add a new origin before attempting to remove the specified " """Used to indicate an attempt to remove the preferred publisher was return _(
"The preferred publisher cannot be removed.")
"""Used to indicate an attempt to search a repo before or after itself""" return _(
"Cannot search a repository before or after itself")
"""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 one or more publisher prefixes are unknown by the specified repository.""" return _(
"The repository at %(location)s does not " "contain package data for %(unknown)s; only " "%(known)s.\n\nThis is either because the " "repository location is not valid, or because the " "provided publisher does not match those known by " return _(
"One or more of the repository origin(s) " "listed below contains package data for " "%(known)s; not %(unknown)s:\n\n%(origins)s\n\n" "This is either because one of the repository " "origins is not valid for this publisher, or " "because the list of known publishers retrieved " "from the repository origin does not match the " return _(
"The specified publisher repository does not " "contain any package data for %(unknown)s; only " """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 """The publisher has no active repositories that support the return _(
"Publisher '%s' has no repositories that support the" """Used to indicate that the specified repository does not provide publisher configuration information.""" return _(
"The specified package repository does not " "provide publisher configuration information.")
return _(
"The package repository at %s does not " "provide publisher configuration information or " "the information provided is incomplete.") % \
return _(
"One of the package repository origins for %s does " "not provide publisher configuration information or the " "information provided is incomplete.") %
self.
pub """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'.") % {
"""The base class for exceptions related to manifest signing.""" # This string method is used by subclasses to fill in the details # about the package and signature involved. return _(
"The relevant signature action is " "found in %(pfmri)s and has a hash of " return _(
"The package involved is:%s") %
self.
pfmri return _(
"The relevant signature action's value " """Exception used when a key, certificate or CRL file is not in a """Exception used when a signature reports a version which this version of pkg(5) doesn't support.""" return _(
"The signature action %(act)s was made using a " "version (%(ver)s) this version of pkg(5) doesn't " """Base class for exceptions encountered while establishing the chain """Exception used when a certificate does not match its expected hash return _(
"Certificate %s has been modified on disk. Its hash " "value is not what was expected.") %
self.
path """Exception used when a chain of trust is rooted in an untrusted self-signed certificate.""" return _(
"Chain was rooted in an untrusted self-signed " """Exception used when a chain of trust can not be established between the leaf certificate and a trust anchor.""" s = _(
"The following problems were encountered:\n") + \
return _(
"The certificate which issued this " "certificate:%(subj)s could not be found. The issuer " """Exception used when a chain of trust contains a revoked certificate. return _(
"This certificate was revoked:%(cert)s for this " """Exception used when a signature could not be verified by the return _(
"A signature in %(pfmri)s could not be " "this reason:\n%(reason)s\nThe signature's hash is " return _(
"The signature with this signature value:\n" "%(sigval)s\n could not be verified for this reason:\n" """Exception used when signatures were required but none were found.""" return _(
"The policy for %(pub_str)s requires " "signatures to be present but no signature was " "found in %(fmri_str)s.") % \
return _(
"The policy for %(pub_str)s requires signatures to be " "present but no signature was found.") % {
"""Exception used when a signature policy required names to be seen return _(
"The policy for %(pub_str)s requires certain " "CNs to be seen in a chain of trust. The following " "required names couldn't be found for this " "package:%(fmri_str)s.\n%(missing)s") % \
return _(
"The policy for %(pub_str)s requires certain CNs to " "be seen in a chain of trust. The following required names " "couldn't be found.\n%(missing)s") % {
"pub_str":
pub_str,
"""Exception used when a certificate in the chain of trust uses a critical extension pkg5 doesn't understand.""" return _(
"The certificate whose subject is %(cert)s could not " "because it uses a critical extension that pkg5 cannot " "handle yet.\nExtension name:%(name)s\nExtension " """Exception used when a property was set to an invalid value.""" """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 returns a line which the client cannot parse correctly.""" return _(
"Gave a bad response:%s") %
self.
line """This exception is used when a file was given as an argument but no such file could be found.""" return _(
"Could not find %s") %
self.
path """Base exception class for all manifest exceptions.""" """Used to indicate that the Manifest signatures are not valid.""" return _(
"The signature data for the manifest of the " "'%s' package is not valid.") %
self.
data return _(
"The signature data for the manifest is not valid.")
"""Used to indicate that one or more exceptions were encountered. This is intended for use with where multiple exceptions for multiple files are encountered and the errors have been condensed into a single exception and re-raised. One example case would be rmtree() # Image creation exceptions return _(
"there is already an image at: %s.\nTo override, use " """Used to indicate that the image configuration is invalid.""" return _(
"The configuration data for the image located at " "'%s' is empty or missing.") %
self.
data return _(
"the specified image path is not empty: %s.\nTo " "override, use the -f (force) option.") %
self.
path """Converts the provided exception into an ApiException equivalent if possible. Returns a new exception object if converted or the original 'ignored_errors' is an optional list of errno values for which None