src/modules/client/api_errors.py
author Shawn Walker <shawn.walker@oracle.com>
Wed, 11 Aug 2010 13:41:25 -0700
changeset 2022 40fbda1e14b7
parent 1970 60471574c487
child 2026 d1b30615bc99
permissions -rw-r--r--
16715 publisher refresh should validate retrieved catalog parts using catalog attributes 16775 catalog refresh should attempt to force cache revalidation when appropriate
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
     1
#!/usr/bin/python
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     2
#
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     3
# CDDL HEADER START
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     4
#
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     8
#
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    12
# and limitations under the License.
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    13
#
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    19
#
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    20
# CDDL HEADER END
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    21
#
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    22
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    23
#
1895
0a260cc2a689 15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents: 1859
diff changeset
    24
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    25
#
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    26
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
    27
import os
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    28
import urlparse
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    29
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    30
# EmptyI for argument defaults; can't import from misc due to circular
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    31
# dependency.
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    32
EmptyI = tuple()
838
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
    33
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    34
class ApiException(Exception):
1540
de040c9fd0c0 13003 exception messages not always displayed correctly with python 2.6
Shawn Walker <srw@sun.com>
parents: 1516
diff changeset
    35
de040c9fd0c0 13003 exception messages not always displayed correctly with python 2.6
Shawn Walker <srw@sun.com>
parents: 1516
diff changeset
    36
        def __unicode__(self):
de040c9fd0c0 13003 exception messages not always displayed correctly with python 2.6
Shawn Walker <srw@sun.com>
parents: 1516
diff changeset
    37
                # To workaround python issues 6108 and 2517, this provides a
de040c9fd0c0 13003 exception messages not always displayed correctly with python 2.6
Shawn Walker <srw@sun.com>
parents: 1516
diff changeset
    38
                # a standard wrapper for this class' exceptions so that they
de040c9fd0c0 13003 exception messages not always displayed correctly with python 2.6
Shawn Walker <srw@sun.com>
parents: 1516
diff changeset
    39
                # have a chance of being stringified correctly.
1968
c0540b1e4f7e 8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents: 1945
diff changeset
    40
                return unicode(str(self))
1540
de040c9fd0c0 13003 exception messages not always displayed correctly with python 2.6
Shawn Walker <srw@sun.com>
parents: 1516
diff changeset
    41
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    42
1710
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    43
class ImageLockedError(ApiException):
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    44
        """Used to indicate that the image is currently locked by another thread
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    45
        or process and cannot be modified."""
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    46
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    47
        def __init__(self, hostname=None, pid=None, pid_name=None):
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    48
                ApiException.__init__(self)
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    49
                self.hostname = hostname
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    50
                self.pid = pid
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    51
                self.pid_name = pid_name
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    52
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    53
        def __str__(self):
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    54
                if self.pid is not None and self.pid_name is not None and \
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    55
                    self.hostname is not None:
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    56
                        return _("The image cannot be modified as it is "
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    57
                            "currently in use by another package client: "
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    58
                            "%(pid_name)s on %(host)s, pid %(pid)s.") % {
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    59
                            "pid_name": self.pid_name, "pid": self.pid,
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    60
                            "host": self.hostname }
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    61
                if self.pid is not None and self.pid_name is not None:
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    62
                        return _("The image cannot be modified as it is "
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    63
                            "currently in use by another package client: "
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    64
                            "%(pid_name)s on an unknown host, pid %(pid)s.") % {
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    65
                            "pid_name": self.pid_name, "pid": self.pid }
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    66
                elif self.pid is not None:
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    67
                        return _("The image cannot be modified as it is "
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    68
                            "currently in use by another package client: "
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    69
                            "pid %(pid)s on %(host)s.") % {
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    70
                            "pid": self.pid, "host": self.hostname }
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    71
                return _("The image cannot be modified as it is currently "
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    72
                    "in use by another package client.")
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
    73
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    74
class ImageNotFoundException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    75
        """Used when an image was not found"""
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    76
        def __init__(self, user_specified, user_dir, root_dir):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    77
                ApiException.__init__(self)
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    78
                self.user_specified = user_specified
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    79
                self.user_dir = user_dir
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    80
                self.root_dir = root_dir
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    81
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    82
class VersionException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    83
        def __init__(self, expected_version, received_version):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    84
                ApiException.__init__(self)
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    85
                self.expected_version = expected_version
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    86
                self.received_version = received_version
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    87
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    88
class PlanExistsException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    89
        def __init__(self, plan_type):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    90
                ApiException.__init__(self)
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    91
                self.plan_type = plan_type
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    92
1618
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
    93
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
    94
class PlanPrepareException(ApiException):
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
    95
        """Base exception class for plan preparation errors."""
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
    96
        pass
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
    97
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
    98
1755
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
    99
class InvalidPackageErrors(ApiException):
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   100
        """Used to indicate that the requested operation could not be completed
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   101
        as one or more packages contained invalid metadata."""
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   102
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   103
        def __init__(self, errors):
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   104
                """'errors' should be a list of exceptions or strings
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   105
                indicating what packages had errors and why."""
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   106
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   107
                ApiException.__init__(self)
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   108
                self.errors = errors
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   109
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   110
        def __str__(self):
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   111
                return _("The requested operation cannot be completed due "
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   112
                    "to invalid package metadata.  Details follow:\n\n"
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   113
                    "%s") % "\n".join(str(e) for e in self.errors)
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   114
8e1ed1373f93 9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents: 1736
diff changeset
   115
1618
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   116
class LicenseAcceptanceError(ApiException):
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   117
        """Used to indicate that license-related errors occurred during
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   118
        plan evaluation or execution."""
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   119
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   120
        def __init__(self, pfmri, src=None, dest=None, accepted=None,
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   121
            displayed=None):
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   122
                ApiException.__init__(self)
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   123
                self.fmri = pfmri
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   124
                self.src = src
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   125
                self.dest = dest
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   126
                self.accepted = accepted
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   127
                self.displayed = displayed
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   128
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   129
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   130
class PkgLicenseErrors(PlanPrepareException):
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   131
        """Used to indicate that plan evaluation or execution failed due
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   132
        to license-related errors for a package."""
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   133
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   134
        def __init__(self, errors):
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   135
                """'errors' should be a list of LicenseAcceptanceError
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   136
                exceptions."""
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   137
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   138
                PlanPrepareException.__init__(self)
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   139
                self.__errors = errors
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   140
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   141
        @property
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   142
        def errors(self):
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   143
                """A list of LicenseAcceptanceError exceptions."""
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   144
                return self.__errors
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   145
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   146
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   147
class PlanLicenseErrors(PlanPrepareException):
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   148
        """Used to indicate that image plan evaluation or execution failed due
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   149
        to license-related errors."""
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   150
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   151
        def __init__(self, pp_errors):
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   152
                """'errors' should be a list of PkgLicenseErrors exceptions."""
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   153
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   154
                PlanPrepareException.__init__(self)
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   155
                self.__errors = pkgs = {}
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   156
                for pp_err in pp_errors:
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   157
                        for e in pp_err.errors:
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   158
                                pkgs.setdefault(str(e.fmri), []).append(e)
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   159
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   160
        @property
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   161
        def errors(self):
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   162
                """Returns a dictionary indexed by package FMRI string of
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   163
                lists of LicenseAcceptanceError exceptions."""
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   164
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   165
                return self.__errors
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   166
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   167
        def __str__(self):
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   168
                """Returns a string representation of the license errors."""
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   169
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   170
                output = ""
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   171
                for sfmri in self.__errors:
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   172
                        output += ("-" * 40) + "\n"
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   173
                        output += _("Package: %s\n\n") % sfmri
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   174
                        for e in self.__errors[sfmri]:
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   175
                                lic_name = e.dest.attrs["license"]
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   176
                                output += _("License: %s\n") % lic_name
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   177
                                if e.dest.must_accept and not e.accepted:
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   178
                                        output += _("  License requires "
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   179
                                            "acceptance.")
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   180
                                if e.dest.must_display and not e.displayed:
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   181
                                        output += _("  License must be viewed.")
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   182
                                output += "\n"
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   183
                return output
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   184
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   185
1019
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
   186
class ActuatorException(ApiException):
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
   187
        def __init__(self, e):
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
   188
                ApiException.__init__(self)
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
   189
                self.exception = e
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
   190
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
   191
        def __str__(self):
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
   192
                return str(self.exception)
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
   193
1618
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   194
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   195
class PrematureExecutionException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   196
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   197
1618
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   198
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   199
class AlreadyPreparedException(PlanPrepareException):
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   200
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   201
1618
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   202
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   203
class AlreadyExecutedException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   204
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   205
1618
04f7471c9e72 5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents: 1603
diff changeset
   206
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   207
class ImageplanStateException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   208
        def __init__(self, state):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   209
                ApiException.__init__(self)
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   210
                self.state = state
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   211
1369
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   212
1710
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
   213
class InvalidPlanError(ApiException):
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
   214
        """Used to indicate that the image plan is no longer valid, likely as a
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
   215
        result of an image state change since the plan was created."""
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
   216
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
   217
        def __str__(self):
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
   218
                return _("The plan for the current operation is no longer "
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
   219
                    "valid.  The image has likely been modified by another "
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
   220
                    "process or client.  Please try the operation again.")
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
   221
139720e2e756 1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents: 1618
diff changeset
   222
1372
484408dfa0a1 11483 ImagePkgStateError needs correction
Shawn Walker <srw@sun.com>
parents: 1370
diff changeset
   223
class ImagePkgStateError(ApiException):
1369
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   224
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   225
        def __init__(self, fmri, states):
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   226
                ApiException.__init__(self)
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   227
                self.fmri = fmri
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   228
                self.states = states
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   229
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   230
        def __str__(self):
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   231
                return _("Invalid package state change attempted '%(states)s' "
1372
484408dfa0a1 11483 ImagePkgStateError needs correction
Shawn Walker <srw@sun.com>
parents: 1370
diff changeset
   232
                    "for package '%(fmri)s'.") % { "states": self.states,
484408dfa0a1 11483 ImagePkgStateError needs correction
Shawn Walker <srw@sun.com>
parents: 1370
diff changeset
   233
                    "fmri": self.fmri }
1369
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   234
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   235
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   236
class IpkgOutOfDateException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   237
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   238
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   239
class ImageUpdateOnLiveImageException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   240
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   241
1328
5c3747a4fe0a 9387 pkg fix should honor reboot-needed flag
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1286
diff changeset
   242
class RebootNeededOnLiveImageException(ApiException):
5c3747a4fe0a 9387 pkg fix should honor reboot-needed flag
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1286
diff changeset
   243
        pass
5c3747a4fe0a 9387 pkg fix should honor reboot-needed flag
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1286
diff changeset
   244
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   245
class CanceledException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   246
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   247
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   248
class PlanMissingException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   249
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   250
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   251
class NoPackagesInstalledException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   252
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   253
685
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   254
class PermissionsException(ApiException):
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   255
        def __init__(self, path):
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   256
                ApiException.__init__(self)
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   257
                self.path = path
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   258
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   259
        def __str__(self):
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   260
                if self.path:
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   261
                        return _("Could not operate on %s\nbecause of "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   262
                            "insufficient permissions. Please try the command "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   263
                            "again using pfexec\nor otherwise increase your "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   264
                            "privileges.") % self.path
685
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   265
                else:
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   266
                        return _("""
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   267
Could not complete the operation because of insufficient permissions. Please
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   268
try the command again using pfexec or otherwise increase your privileges.
685
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   269
""")
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   270
879
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   271
class FileInUseException(PermissionsException):
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   272
        def __init__(self, path):
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   273
                PermissionsException.__init__(self, path)
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   274
                assert path
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   275
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   276
        def __str__(self):
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   277
                return _("Could not operate on %s\nbecause the file is "
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   278
                    "in use. Please stop using the file and try the\n"
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   279
                    "operation again.") % self.path
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   280
1335
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   281
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   282
class ReadOnlyFileSystemException(PermissionsException):
1945
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   283
        """Used to indicate that the operation was attempted on a
1335
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   284
        read-only filesystem"""
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   285
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   286
        def __init__(self, path):
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   287
                ApiException.__init__(self)
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   288
                self.path = path
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   289
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   290
        def __str__(self):
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   291
                if self.path:
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   292
                        return _("Could not complete the operation on %s: "
1968
c0540b1e4f7e 8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents: 1945
diff changeset
   293
                            "read-only filesystem.") % self.path
1335
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   294
                return _("Could not complete the operation: read-only "
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   295
                        "filesystem.")
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   296
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   297
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   298
class PlanCreationException(ApiException):
1141
a74d6815a7fc 4178 unfound_fmris is a poor name
Rich Burridge <rich.burridge@sun.com>
parents: 1130
diff changeset
   299
        def __init__(self, unmatched_fmris=EmptyI, multiple_matches=EmptyI,
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   300
            missing_matches=EmptyI, illegal=EmptyI,
1945
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   301
            badarch=EmptyI, installed=EmptyI, multispec=EmptyI,
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   302
            no_solution=False, no_version=EmptyI, missing_dependency=EmptyI,
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   303
            wrong_publishers=EmptyI, obsolete=EmptyI):
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   304
                ApiException.__init__(self)
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   305
                self.unmatched_fmris       = unmatched_fmris
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   306
                self.multiple_matches      = multiple_matches
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   307
                self.missing_matches       = missing_matches
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   308
                self.illegal               = illegal
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   309
                self.badarch               = badarch
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   310
                self.installed             = installed
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   311
                self.multispec             = multispec
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1431
diff changeset
   312
                self.obsolete = obsolete
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   313
                self.no_solution           = no_solution
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   314
                self.no_version            = no_version
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   315
                self.missing_dependency    = missing_dependency
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   316
                self.wrong_publishers      = wrong_publishers
838
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
   317
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   318
        def __str__(self):
616
6d307b088d92 4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents: 614
diff changeset
   319
                res = []
1141
a74d6815a7fc 4178 unfound_fmris is a poor name
Rich Burridge <rich.burridge@sun.com>
parents: 1130
diff changeset
   320
                if self.unmatched_fmris:
616
6d307b088d92 4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents: 614
diff changeset
   321
                        s = _("""\
988
a851ba83a5aa 6654 pkg list state incorrect after publisher removal when another publisher has it
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 941
diff changeset
   322
The following pattern(s) did not match any packages in the current catalog.
a851ba83a5aa 6654 pkg list state incorrect after publisher removal when another publisher has it
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 941
diff changeset
   323
Try relaxing the pattern, refreshing and/or examining the catalogs:""")
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   324
                        res += [s]
1141
a74d6815a7fc 4178 unfound_fmris is a poor name
Rich Burridge <rich.burridge@sun.com>
parents: 1130
diff changeset
   325
                        res += ["\t%s" % p for p in self.unmatched_fmris]
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   326
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   327
                if self.wrong_publishers:
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   328
                        s = _("The following patterns only matched packages "
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   329
                            "that are from publishers other than that which "
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   330
                            "supplied the already installed version of this package")
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   331
                        res += [s]
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   332
                        res += ["\t%s: %s" % (p[0], ", ".join(p[1])) for p in self.wrong_publishers]
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   333
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   334
                if self.multiple_matches:
988
a851ba83a5aa 6654 pkg list state incorrect after publisher removal when another publisher has it
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 941
diff changeset
   335
                        s = _("'%s' matches multiple packages")
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   336
                        for p, lst in self.multiple_matches:
922
0074b10d84e0 6874 stack trace on install with ambiguous package names
Danek Duvall <danek.duvall@sun.com>
parents: 917
diff changeset
   337
                                res.append(s % p)
0074b10d84e0 6874 stack trace on install with ambiguous package names
Danek Duvall <danek.duvall@sun.com>
parents: 917
diff changeset
   338
                                for pfmri in lst:
633
12f974919ab3 4204 Traceback when attempting to uninstall a package that I have multiples of
Brock Pytlik <bpytlik@sun.com>
parents: 616
diff changeset
   339
                                        res.append("\t%s" % pfmri)
616
6d307b088d92 4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents: 614
diff changeset
   340
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   341
                if self.missing_matches:
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   342
                        s = _("'%s' matches no installed packages")
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   343
                        res += [ s % p for p in self.missing_matches ]
616
6d307b088d92 4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents: 614
diff changeset
   344
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   345
                if self.illegal:
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   346
                        s = _("'%s' is an illegal fmri")
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   347
                        res += [ s % p for p in self.illegal ]
655
6eef82185057 2325 optional dependency enforcement can't handle fmris disappearing from the catalog
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 633
diff changeset
   348
838
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
   349
                if self.badarch:
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
   350
                        s = _("'%s' supports the following architectures: %s")
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
   351
                        a = _("Image architecture is defined as: %s")
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   352
                        res += [ s % (self.badarch[0],
838
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
   353
                            ", ".join(self.badarch[1]))]
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
   354
                        res += [ a % (self.badarch[2])]
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
   355
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1431
diff changeset
   356
                s = _("'%(p)s' depends on obsolete package '%(op)s'")
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1431
diff changeset
   357
                res += [ s % {"p": p, "op": op} for p, op in self.obsolete ]
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1431
diff changeset
   358
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   359
                if self.installed:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   360
                        s = _("The proposed operation can not be performed for "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   361
                            "the following package(s) as they are already "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   362
                            "installed: ")
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   363
                        res += [s]
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   364
                        res += ["\t%s" % p for p in self.installed]
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   365
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   366
                if self.multispec:
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   367
                        s = _("The following different patterns specify the"
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   368
                              "same package(s):")
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   369
                        res += [s]
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   370
                        for t in self.multispec:
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   371
                                res += [
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   372
                                        ", ".join(
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   373
                                        [t[i] for i in range(1, len(t))])
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   374
                                        + ": %s" % t[0]
1945
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   375
                                        ]
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   376
                if self.no_solution:
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   377
                        res += [_("No solution was found to satisfy constraints")]
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   378
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   379
                if self.no_version:
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   380
                        res += self.no_version
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   381
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   382
                if self.missing_dependency:
1945
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   383
                        res += [_("Package %(pkg)s is missing a dependency: "
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   384
                            "%(dep)s") %
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   385
                            {"pkg": self.missing_dependency[0],
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   386
                             "dep": self.missing_dependency[1]}]
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   387
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   388
                return "\n".join(res)
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   389
1068
9400aa8afd32 2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents: 1053
diff changeset
   390
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   391
class ActionExecutionError(ApiException):
1859
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   392
        """Used to indicate that action execution (such as install, remove,
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   393
        etc.) failed even though the action is valid.
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   394
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   395
        In particular, this exception indicates that something went wrong in the
1859
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   396
        application (or unapplication) of the action to the system, and is most
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   397
        likely not an error in the pkg(5) code."""
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   398
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   399
        def __init__(self, action, details=None, error=None, fmri=None,
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   400
            use_errno=None):
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   401
                """'action' is the object for the action that failed during the
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   402
                requested operation.
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   403
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   404
                'details' is an optional message explaining what operation
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   405
                failed, why it failed, and why it cannot continue.  It should
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   406
                also include a suggestion as to how to resolve the situation
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   407
                if possible.
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   408
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   409
                'error' is an optional exception object that may have been
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   410
                raised when the operation failed.
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   411
1859
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   412
                'fmri' is an optional package FMRI indicating what package
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   413
                was being operated on at the time the error occurred.
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   414
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   415
                'use_errno' is an optional boolean value indicating whether
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   416
                the strerror() text of the exception should be used.  If
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   417
                'details' is provided, the default value is False, otherwise
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   418
                True."""
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   419
1859
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   420
                assert (details or error)
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   421
                self.action = action
1859
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   422
                self.details = details
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   423
                self.error = error
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   424
                self.fmri = fmri
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   425
                if use_errno == None:
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   426
                        # If details were provided, don't use errno unless
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   427
                        # explicitly requested.
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   428
                        use_errno = not details
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   429
                self.use_errno = use_errno
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   430
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   431
        def __str__(self):
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   432
                errno = ""
1859
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   433
                if self.use_errno and self.error and \
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   434
                    hasattr(self.error, "errno"):
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   435
                        errno = "[errno %d: %s]" % (self.error.errno,
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   436
                            os.strerror(self.error.errno))
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   437
1859
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   438
                details = self.details or ""
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   439
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   440
                # Fall back on the wrapped exception if we don't have anything
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   441
                # useful.
1859
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   442
                if not errno and not details:
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   443
                        return str(self.error)
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   444
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   445
                if errno and details:
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   446
                        details = "%s: %s" % (errno, details)
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   447
1859
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   448
                if details and not self.fmri:
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   449
                        details = _("Requested operation failed for action "
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   450
                            "%(action)s:\n%(details)s") % {
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   451
                            "action": self.action,
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   452
                            "details": msg }
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   453
                elif details:
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   454
                        details = _("Requested operation failed for package "
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   455
                            "%(fmri)s:\n%(details)s") % { "fmri": self.fmri,
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   456
                            "details": details }
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   457
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   458
                # If we only have one of the two, no need for the colon.
1859
6e6e866921e7 529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents: 1755
diff changeset
   459
                return "%s%s" % (errno, details)
1050
54c841d1fad9 1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents: 1027
diff changeset
   460
1068
9400aa8afd32 2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents: 1053
diff changeset
   461
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   462
class CatalogRefreshException(ApiException):
1603
84bd53597209 13019 DeprecationWarnings seen after python 2.6 migration
Dan Price <dp@eng.sun.com>
parents: 1540
diff changeset
   463
        def __init__(self, failed, total, succeeded, errmessage=None):
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   464
                ApiException.__init__(self)
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   465
                self.failed = failed
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   466
                self.total = total
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   467
                self.succeeded = succeeded
1603
84bd53597209 13019 DeprecationWarnings seen after python 2.6 migration
Dan Price <dp@eng.sun.com>
parents: 1540
diff changeset
   468
                self.errmessage = errmessage
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   469
1068
9400aa8afd32 2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents: 1053
diff changeset
   470
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   471
class CatalogError(ApiException):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   472
        """Base exception class for all catalog exceptions."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   473
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   474
        def __init__(self, *args, **kwargs):
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   475
                ApiException.__init__(self)
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   476
                if args:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   477
                        self.data = args[0]
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   478
                else:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   479
                        self.data = None
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
   480
                self._args = kwargs
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   481
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   482
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   483
                return str(self.data)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   484
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   485
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   486
class AnarchicalCatalogFMRI(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   487
        """Used to indicate that the specified FMRI is not valid for catalog
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   488
        operations because it is missing publisher information."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   489
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   490
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   491
                return _("The FMRI '%s' does not contain publisher information "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   492
                    "and cannot be used for catalog operations.") % self.data
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   493
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   494
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   495
class BadCatalogMetaRoot(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   496
        """Used to indicate an operation on the catalog's meta_root failed
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   497
        because the meta_root is invalid."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   498
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   499
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   500
                return _("Catalog meta_root '%(root)s' is invalid; unable "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   501
                    "to complete operation: '%(op)s'.") % { "root": self.data,
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
   502
                    "op": self._args.get("operation", None) }
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   503
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   504
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   505
class BadCatalogPermissions(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   506
        """Used to indicate the server catalog files do not have the expected
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   507
        permissions."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   508
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   509
        def __init__(self, files):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   510
                """files should contain a list object with each entry consisting
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   511
                of a tuple of filename, expected_mode, received_mode."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   512
                if not files:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   513
                        files = []
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   514
                CatalogError.__init__(self, files)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   515
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   516
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   517
                msg = _("The following catalog files have incorrect "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   518
                    "permissions:\n")
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
   519
                for f in self._args:
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   520
                        fname, emode, fmode = f
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   521
                        msg += _("\t%(fname)s: expected mode: %(emode)s, found "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   522
                            "mode: %(fmode)s\n") % { "fname": fname,
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   523
                            "emode": emode, "fmode": fmode }
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   524
                return msg
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   525
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   526
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   527
class BadCatalogSignatures(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   528
        """Used to indicate that the Catalog signatures are not valid."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   529
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   530
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   531
                return _("The signature data for the '%s' catalog file is not "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   532
                    "valid.") % self.data
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   533
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   534
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   535
class BadCatalogUpdateIdentity(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   536
        """Used to indicate that the requested catalog updates could not be
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   537
        applied as the new catalog data is significantly different such that
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   538
        the old catalog cannot be updated to match it."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   539
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   540
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   541
                return _("Unable to determine the updates needed for  "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   542
                    "the current catalog using the provided catalog "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   543
                    "update data in '%s'.") % self.data
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   544
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   545
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   546
class DuplicateCatalogEntry(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   547
        """Used to indicate that the specified catalog operation could not be
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   548
        performed since it would result in a duplicate catalog entry."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   549
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   550
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   551
                return _("Unable to perform '%(op)s' operation for catalog "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   552
                    "%(name)s; completion would result in a duplicate entry "
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
   553
                    "for package '%(fmri)s'.") % { "op": self._args.get(
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
   554
                    "operation", None), "name": self._args.get("catalog_name",
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   555
                    None), "fmri": self.data }
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   556
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   557
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   558
class CatalogUpdateRequirements(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   559
        """Used to indicate that an update request for the catalog could not
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   560
        be performed because update requirements were not satisfied."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   561
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   562
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   563
                return _("Catalog updates can only be applied to an on-disk "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   564
                    "catalog.")
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   565
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   566
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   567
class InvalidCatalogFile(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   568
        """Used to indicate a Catalog file could not be loaded."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   569
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   570
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   571
                return _("Catalog file '%s' is invalid.") % self.data
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   572
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   573
2022
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   574
class MismatchedCatalog(CatalogError):
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   575
        """Used to indicate that a Catalog's attributes and parts do not
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   576
        match.  This is likely the result of an attributes file being
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   577
        retrieved which doesn't match the parts that were retrieved such
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   578
        as in a misconfigured or stale cache case."""
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   579
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   580
        def __str__(self):
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   581
                return _("The content of the catalog for publisher '%s' "
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   582
                    "doesn't match the catalog's attributes.  This is "
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   583
                    "likely the result of a mix of older and newer "
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   584
                    "catalog files being provided for the publisher.") % \
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   585
                    self.data
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   586
40fbda1e14b7 16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents: 1970
diff changeset
   587
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   588
class ObsoleteCatalogUpdate(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   589
        """Used to indicate that the specified catalog updates are for an older
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   590
        version of the catalog and cannot be applied."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   591
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   592
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   593
                return _("Unable to determine the updates needed for the "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   594
                    "catalog using the provided catalog update data in '%s'. "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   595
                    "The specified catalog updates are for an older version "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   596
                    "of the catalog and cannot be used.") % self.data
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   597
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   598
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   599
class UnknownCatalogEntry(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   600
        """Used to indicate that an entry for the specified package FMRI or
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   601
        pattern could not be found in the catalog."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   602
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   603
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   604
                return _("'%s' could not be found in the catalog.") % self.data
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   605
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   606
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   607
class UnknownUpdateType(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   608
        """Used to indicate that the specified CatalogUpdate operation is
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   609
        unknown."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   610
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   611
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   612
                return _("Unknown catalog update type '%s'") % self.data
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   613
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   614
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   615
class UnrecognizedCatalogPart(CatalogError):
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   616
        """Raised when the catalog finds a CatalogPart that is unrecognized
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   617
        or invalid."""
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   618
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   619
        def __str__(self):
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   620
                return _("Unrecognized, unknown, or invalid CatalogPart '%s'") \
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   621
                    % self.data
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   622
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   623
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   624
class InventoryException(ApiException):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   625
        """Used to indicate that some of the specified patterns to a catalog
1970
60471574c487 16238 client api should ignore invalid and not yet supported packages
Shawn Walker <shawn.walker@oracle.com>
parents: 1968
diff changeset
   626
        matching function did not match any catalog entries, or were invalid
60471574c487 16238 client api should ignore invalid and not yet supported packages
Shawn Walker <shawn.walker@oracle.com>
parents: 1968
diff changeset
   627
        patterns."""
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   628
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   629
        def __init__(self, illegal=EmptyI, matcher=EmptyI, notfound=EmptyI,
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   630
            publisher=EmptyI, version=EmptyI):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   631
                ApiException.__init__(self)
838
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
   632
                self.illegal = illegal
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   633
                self.matcher = matcher
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   634
                self.notfound = set(notfound)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   635
                self.publisher = publisher
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   636
                self.version = version
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   637
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   638
                self.notfound.update(matcher)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   639
                self.notfound.update(publisher)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   640
                self.notfound.update(version)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   641
                self.notfound = list(self.notfound)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   642
1945
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   643
                assert self.illegal or self.notfound
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   644
596
f4519e2a99bc 3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 565
diff changeset
   645
        def __str__(self):
f4519e2a99bc 3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 565
diff changeset
   646
                outstr = ""
f4519e2a99bc 3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 565
diff changeset
   647
                for x in self.illegal:
f4519e2a99bc 3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 565
diff changeset
   648
                        # Illegal FMRIs have their own __str__ method
f4519e2a99bc 3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 565
diff changeset
   649
                        outstr += "%s\n" % x
614
4b620a1e8c01 4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 596
diff changeset
   650
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   651
                if self.matcher or self.publisher or self.version:
614
4b620a1e8c01 4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 596
diff changeset
   652
                        outstr += _("No matching package could be found for "
4b620a1e8c01 4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 596
diff changeset
   653
                            "the following FMRIs in any of the catalogs for "
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   654
                            "the current publishers:\n")
614
4b620a1e8c01 4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 596
diff changeset
   655
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   656
                        for x in self.matcher:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   657
                                outstr += _("%s (pattern did not match)\n") % x
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   658
                        for x in self.publisher:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   659
                                outstr += _("%s (publisher did not "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   660
                                    "match)\n") % x
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   661
                        for x in self.version:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   662
                                outstr += _("%s (version did not match)\n") % x
596
f4519e2a99bc 3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 565
diff changeset
   663
                return outstr
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   664
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   665
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   666
# SearchExceptions
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   667
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   668
class SearchException(ApiException):
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   669
        """Based class used for all search-related api exceptions."""
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   670
        pass
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   671
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   672
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   673
class MainDictParsingException(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   674
        """This is used when the main dictionary could not parse a line."""
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   675
        def __init__(self, e):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   676
                SearchException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   677
                self.e = e
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   678
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   679
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   680
                return str(self.e)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   681
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   682
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   683
class MalformedSearchRequest(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   684
        """Raised when the server cannot understand the format of the
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   685
        search request."""
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   686
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   687
        def __init__(self, url):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   688
                SearchException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   689
                self.url = url
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   690
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   691
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   692
                return str(self.url)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   693
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   694
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   695
class NegativeSearchResult(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   696
        """Returned when the search cannot find any matches."""
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   697
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   698
        def __init__(self, url):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   699
                SearchException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   700
                self.url = url
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   701
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   702
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   703
                return _("The search at url %s returned no results.") % self.url
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   704
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   705
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   706
class ProblematicSearchServers(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   707
        """This class wraps exceptions which could appear while trying to
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   708
        do a search request."""
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   709
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   710
        def __init__(self, failed=EmptyI, invalid=EmptyI, unsupported=EmptyI):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   711
                SearchException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   712
                self.failed_servers = failed
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   713
                self.invalid_servers  = invalid
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   714
                self.unsupported_servers = unsupported
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   715
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   716
        def __str__(self):
1895
0a260cc2a689 15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents: 1859
diff changeset
   717
                s = _("Some repositories failed to respond appropriately:\n")
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   718
                for pub, err in self.failed_servers:
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   719
                        s += _("%(o)s:\n%(msg)s\n") % \
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   720
                            { "o": pub, "msg": err}
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   721
                for pub in self.invalid_servers:
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   722
                        s += _("%s did not return a valid response.\n" \
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   723
                            % pub)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   724
                if len(self.unsupported_servers) > 0:
1895
0a260cc2a689 15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents: 1859
diff changeset
   725
                        s += _("Some repositories don't support requested "
0a260cc2a689 15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents: 1859
diff changeset
   726
                            "search operation:\n")
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   727
                for pub, err in self.unsupported_servers:
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   728
                        s += _("%(o)s:\n%(msg)s\n") % \
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   729
                            { "o": pub, "msg": err}
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   730
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   731
                return s
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   732
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   733
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   734
class SlowSearchUsed(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   735
        """This exception is thrown when a local search is performed without
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   736
        an index.  It's raised after all results have been yielded."""
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   737
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   738
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   739
                return _("Search performance is degraded.\n"
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   740
                    "Run 'pkg rebuild-index' to improve search speed.")
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   741
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   742
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   743
class UnsupportedSearchError(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   744
        """Returned when a search protocol is not supported by the
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   745
        remote server."""
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   746
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   747
        def __init__(self, url=None, proto=None):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   748
                SearchException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   749
                self.url = url
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   750
                self.proto = proto
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   751
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   752
        def __str__(self):
1895
0a260cc2a689 15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents: 1859
diff changeset
   753
                s = _("Search repository does not support the requested "
0a260cc2a689 15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents: 1859
diff changeset
   754
                    "protocol:")
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   755
                if self.url:
1895
0a260cc2a689 15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents: 1859
diff changeset
   756
                        s += "\nRepository URL: %s" % self.url
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   757
                if self.proto:
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   758
                        s += "\nRequested operation: %s" % self.proto
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   759
                return s
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   760
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   761
        def __cmp__(self, other):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   762
                if not isinstance(other, UnsupportedSearchError):
1945
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   763
                        return -1
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   764
                r = cmp(self.url, other.url)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   765
                if r != 0:
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   766
                        return r
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   767
                return cmp(self.proto, other.proto)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   768
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   769
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   770
# IndexingExceptions.
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   771
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   772
class IndexingException(SearchException):
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   773
        """ The base class for all exceptions that can occur while indexing. """
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   774
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   775
        def __init__(self, private_exception):
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   776
                SearchException.__init__(self)
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   777
                self.cause = private_exception.cause
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   778
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   779
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   780
class CorruptedIndexException(IndexingException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   781
        """This is used when the index is not in a correct state."""
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   782
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   783
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   784
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   785
class InconsistentIndexException(IndexingException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   786
        """This is used when the existing index is found to have inconsistent
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   787
        versions."""
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   788
        def __init__(self, e):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   789
                IndexingException.__init__(self, e)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   790
                self.exception = e
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   791
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   792
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   793
                return str(self.exception)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   794
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   795
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   796
class ProblematicPermissionsIndexException(IndexingException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   797
        """ This is used when the indexer is unable to create, move, or remove
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   798
        files or directories it should be able to. """
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   799
        def __str__(self):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   800
                return "Could not remove or create " \
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   801
                    "%s because of incorrect " \
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   802
                    "permissions. Please correct this issue then " \
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   803
                    "rebuild the index." % self.cause
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   804
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   805
class WrapIndexingException(ApiException):
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   806
        """This exception is used to wrap an indexing exception during install,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   807
        uninstall, or image-update so that a more appropriate error message
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   808
        can be displayed to the user."""
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   809
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   810
        def __init__(self, e, tb, stack):
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   811
                ApiException.__init__(self)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   812
                self.wrapped = e
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   813
                self.tb = tb
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   814
                self.stack = stack
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   815
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   816
        def __str__(self):
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   817
                tmp = self.tb.split("\n")
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   818
                res = tmp[:1] + [s.rstrip("\n") for s in self.stack] + tmp[1:]
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   819
                return "\n".join(res)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   820
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   821
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   822
class WrapSuccessfulIndexingException(WrapIndexingException):
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   823
        """This exception is used to wrap an indexing exception during install,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   824
        uninstall, or image-update which was recovered from by performing a
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   825
        full reindex."""
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   826
        pass
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   827
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   828
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   829
# Query Parsing Exceptions
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   830
class BooleanQueryException(ApiException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   831
        """This exception is used when the children of a boolean operation
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   832
        have different return types.  The command 'pkg search foo AND <bar>'
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   833
        is the simplest example of this."""
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   834
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   835
        def __init__(self, e):
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   836
                ApiException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   837
                self.e = e
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   838
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   839
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   840
                return str(self.e)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   841
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   842
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   843
class ParseError(ApiException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   844
        def __init__(self, e):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   845
                ApiException.__init__(self)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   846
                self.e = e
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   847
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   848
        def __str__(self):
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   849
                return str(self.e)
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   850
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   851
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   852
class NonLeafPackageException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   853
        """Removal of a package which satisfies dependencies has been attempted.
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   854
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   855
        The first argument to the constructor is the FMRI which we tried to
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   856
        remove, and is available as the "fmri" member of the exception.  The
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   857
        second argument is the list of dependent packages that prevent the
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   858
        removal of the package, and is available as the "dependents" member.
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   859
        """
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   860
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   861
        def __init__(self, *args):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   862
                ApiException.__init__(self, *args)
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   863
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   864
                self.fmri = args[0]
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   865
                self.dependents = args[1]
835
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   866
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   867
class InvalidDepotResponseException(ApiException):
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   868
        """Raised when the depot doesn't have versions of operations
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   869
        that the client needs to operate successfully."""
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   870
        def __init__(self, url, data):
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   871
                ApiException.__init__(self)
835
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   872
                self.url = url
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   873
                self.data = data
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   874
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   875
        def __str__(self):
1895
0a260cc2a689 15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents: 1859
diff changeset
   876
                s = "Unable to contact valid package repository"
835
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   877
                if self.url:
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   878
                        s += ": %s" % self.url
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   879
                if self.data:
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   880
                        s += "\nEncountered the following error(s):\n%s" % \
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   881
                            self.data
34ec4401dc48 686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents: 717
diff changeset
   882
                return s
884
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   883
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   884
class DataError(ApiException):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   885
        """Base exception class used for all data related errors."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   886
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   887
        def __init__(self, *args, **kwargs):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   888
                ApiException.__init__(self, *args)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   889
                if args:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   890
                        self.data = args[0]
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   891
                else:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   892
                        self.data = None
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
   893
                self._args = kwargs
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   894
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   895
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   896
class InvalidP5IFile(DataError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   897
        """Used to indicate that the specified location does not contain a
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   898
        valid p5i-formatted file."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   899
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   900
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   901
                if self.data:
1736
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
   902
                        return _("The provided p5i data is in an unrecognized "
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   903
                            "format or does not contain valid publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   904
                            "information: %s") % self.data
1736
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
   905
                return _("The provided p5i data is in an unrecognized format "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
   906
                    "or does not contain valid publisher information.")
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   907
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   908
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   909
class UnsupportedP5IFile(DataError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   910
        """Used to indicate that an attempt to read an unsupported version
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   911
        of pkg(5) info file was attempted."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   912
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   913
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   914
                return _("Unsupported pkg(5) publisher information data "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   915
                    "format.")
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   916
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   917
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   918
class TransportError(ApiException):
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   919
        """Abstract exception class for all transport exceptions.
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   920
        Specific transport exceptions should be implemented in the
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   921
        transport code.  Callers wishing to catch transport exceptions
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   922
        should use this class.  Subclasses must implement all methods
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   923
        defined here that raise NotImplementedError."""
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   924
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   925
        def __str__(self):
1540
de040c9fd0c0 13003 exception messages not always displayed correctly with python 2.6
Shawn Walker <srw@sun.com>
parents: 1516
diff changeset
   926
                raise NotImplementedError()
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   927
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   928
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   929
class RetrievalError(ApiException):
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   930
        """Used to indicate that a a requested resource could not be
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   931
        retrieved."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   932
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   933
        def __init__(self, data, location=None):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   934
                ApiException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   935
                self.data = data
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   936
                self.location = location
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   937
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   938
        def __str__(self):
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   939
                if self.location:
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   940
                        return _("Error encountered while retrieving data from "
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   941
                            "'%s':\n%s") % (self.location, self.data)
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   942
                return _("Error encountered while retrieving data from: %s") % \
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   943
                    self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   944
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   945
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   946
class InvalidResourceLocation(ApiException):
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   947
        """Used to indicate that an invalid transport location was provided."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   948
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   949
        def __init__(self, data):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   950
                ApiException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   951
                self.data = data
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   952
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   953
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   954
                return _("'%s' is not a valid location.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   955
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   956
class BEException(ApiException):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   957
        def __init__(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   958
                ApiException.__init__(self)
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   959
884
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   960
class InvalidBENameException(BEException):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   961
        def __init__(self, be_name):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   962
                BEException.__init__(self)
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   963
                self.be_name = be_name
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   964
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   965
        def __str__(self):
1076
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   966
                return _("'%s' is not a valid boot environment name.") % \
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   967
                    self.be_name
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   968
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   969
class DuplicateBEName(BEException):
1945
a4fc142accb2 16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents: 1937
diff changeset
   970
        """Used to indicate that there is an existing boot environment
1076
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   971
        with this name"""
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   972
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   973
        def __init__(self, be_name):
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   974
                BEException.__init__(self)
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   975
                self.be_name = be_name
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   976
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   977
        def __str__(self):
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   978
                return _("The boot environment '%s' already exists.") % \
db86977aa656 8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents: 1068
diff changeset
   979
                    self.be_name
884
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   980
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   981
class BENamingNotSupported(BEException):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   982
        def __init__(self, be_name):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   983
                BEException.__init__(self)
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   984
                self.be_name = be_name
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   985
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   986
        def __str__(self):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   987
                return _("""\
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   988
Boot environment naming during package install is not supported on this
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   989
version of OpenSolaris. Please image-update without the --be-name option.""")
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   990
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   991
class UnableToCopyBE(BEException):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   992
        def __str__(self):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   993
                return _("Unable to clone the current boot environment.")
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   994
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   995
class UnableToRenameBE(BEException):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   996
        def __init__(self, orig, dest):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   997
                BEException.__init__(self)
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   998
                self.original_name = orig
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
   999
                self.destination_name = dest
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1000
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1001
        def __str__(self):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1002
                d = {
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1003
                    "orig": self.original_name,
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1004
                    "dest": self.destination_name
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1005
                }
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1006
                return _("""\
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1007
A problem occurred while attempting to rename the boot environment
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1008
currently named %(orig)s to %(dest)s.""") % d
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1009
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1010
class UnableToMountBE(BEException):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1011
        def __init__(self, be_name, be_dir):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1012
                BEException.__init__(self)
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1013
                self.name = be_name
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1014
                self.mountpoint = be_dir
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1015
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1016
        def __str__(self):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1017
                return _("Unable to mount %(name)s at %(mt)s") % \
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1018
                    {"name": self.name, "mt": self.mountpoint}
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1019
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1020
class BENameGivenOnDeadBE(BEException):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1021
        def __init__(self, be_name):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1022
                BEException.__init__(self)
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1023
                self.name = be_name
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1024
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1025
        def __str__(self):
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1026
                return _("""\
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1027
Naming a boot environment when operating on a non-live image is
d780afc023ff 3718 plan_update_all needs to have an optional argument for the new BE name
Brock Pytlik <bpytlik@sun.com>
parents: 879
diff changeset
  1028
not allowed.""")
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1029
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1030
917
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 884
diff changeset
  1031
class UnrecognizedOptionsToInfo(ApiException):
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 884
diff changeset
  1032
        def __init__(self, opts):
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 884
diff changeset
  1033
                ApiException.__init__(self)
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 884
diff changeset
  1034
                self._opts = opts
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 884
diff changeset
  1035
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 884
diff changeset
  1036
        def __str__(self):
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 884
diff changeset
  1037
                s = _("Info does not recognize the following options:")
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 884
diff changeset
  1038
                for o in self._opts:
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 884
diff changeset
  1039
                        s += _(" '") + str(o) + _("'")
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 884
diff changeset
  1040
                return s
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1041
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1042
class IncorrectIndexFileHash(ApiException):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1043
        """This is used when the index hash value doesn't match the hash of the
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1044
        packages installed in the image."""
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1045
        pass
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1046
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1047
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1048
class PublisherError(ApiException):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1049
        """Base exception class for all publisher exceptions."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1050
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1051
        def __init__(self, *args, **kwargs):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1052
                ApiException.__init__(self, *args)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1053
                if args:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1054
                        self.data = args[0]
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1055
                else:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1056
                        self.data = None
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1057
                self._args = kwargs
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1058
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1059
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1060
                return str(self.data)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1061
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1062
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
  1063
class BadPublisherMetaRoot(PublisherError):
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
  1064
        """Used to indicate an operation on the publisher's meta_root failed
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
  1065
        because the meta_root is invalid."""
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
  1066
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
  1067
        def __str__(self):
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
  1068
                return _("Publisher meta_root '%(root)s' is invalid; unable "
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
  1069
                    "to complete operation: '%(op)s'.") % { "root": self.data,
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1070
                    "op": self._args.get("operation", None) }
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
  1071
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
  1072
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1073
class BadPublisherPrefix(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1074
        """Used to indicate that a publisher name is not valid."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1075
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1076
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1077
                return _("'%s' is not a valid publisher name.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1078
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1079
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1080
class BadRepositoryAttributeValue(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1081
        """Used to indicate that the specified repository attribute value is
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1082
        invalid."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1083
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1084
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1085
                return _("'%(value)s' is not a valid value for repository "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1086
                    "attribute '%(attribute)s'.") % {
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1087
                    "value": self._args["value"], "attribute": self.data }
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1088
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1089
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1090
class BadRepositoryCollectionType(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1091
        """Used to indicate that the specified repository collection type is
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1092
        invalid."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1093
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1094
        def __init__(self, *args, **kwargs):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1095
                PublisherError.__init__(self, *args, **kwargs)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1096
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1097
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1098
                return _("'%s' is not a valid repository collection type.") % \
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1099
                    self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1100
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1101
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1102
class BadRepositoryURI(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1103
        """Used to indicate that a repository URI is not syntactically valid."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1104
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1105
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1106
                return _("'%s' is not a valid URI.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1107
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1108
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1109
class BadRepositoryURIPriority(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1110
        """Used to indicate that the priority specified for a repository URI is
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1111
        not valid."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1112
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1113
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1114
                return _("'%s' is not a valid URI priority; integer value "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1115
                    "expected.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1116
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1117
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1118
class BadRepositoryURISortPolicy(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1119
        """Used to indicate that the specified repository URI sort policy is
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1120
        invalid."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1121
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1122
        def __init__(self, *args, **kwargs):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1123
                PublisherError.__init__(self, *args, **kwargs)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1124
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1125
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1126
                return _("'%s' is not a valid repository URI sort policy.") % \
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1127
                    self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1128
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1129
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1130
class DisabledPublisher(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1131
        """Used to indicate that an attempt to use a disabled publisher occurred
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1132
        during an operation."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1133
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1134
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1135
                return _("Publisher '%s' is disabled and cannot be used for "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1136
                    "packaging operations.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1137
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1138
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1139
class DuplicatePublisher(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1140
        """Used to indicate that a publisher with the same name or alias already
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1141
        exists for an image."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1142
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1143
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1144
                return _("A publisher with the same name or alias as '%s' "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1145
                    "already exists.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1146
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1147
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1148
class DuplicateRepository(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1149
        """Used to indicate that a repository with the same origin uris
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1150
        already exists for a publisher."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1151
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1152
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1153
                return _("A repository with the same name or origin URIs "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1154
                   "already exists for publisher '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1155
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1156
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1157
class DuplicateRepositoryMirror(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1158
        """Used to indicate that a repository URI is already in use by another
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1159
        repository mirror."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1160
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1161
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1162
                return _("Mirror '%s' already exists for the specified "
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1163
                    "publisher.") % self.data
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1164
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1165
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1166
class DuplicateRepositoryOrigin(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1167
        """Used to indicate that a repository URI is already in use by another
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1168
        repository origin."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1169
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1170
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1171
                return _("Origin '%s' already exists for the specified "
1504
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1172
                    "publisher.") % self.data
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1173
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1174
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1175
class PublisherOriginRequired(PublisherError):
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1176
        """Used to indicate that the specified publisher must have at least one
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1177
        repository with at least one origin URI."""
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1178
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1179
        def __str__(self):
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1180
                return _("At least one origin is required for %s.  You must "
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1181
                "add a new origin before attempting to remove the specified "
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
  1182
                "origin(s).") % self.data
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1183
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1184
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1185
class RemovePreferredPublisher(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1186
        """Used to indicate an attempt to remove the preferred publisher was
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1187
        made."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1188
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1189
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1190
                return _("The preferred publisher cannot be removed.")
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1191
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1192
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
  1193
class MoveRelativeToSelf(PublisherError):
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
  1194
        """Used to indicate an attempt to search a repo before or after itself"""
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
  1195
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
  1196
        def __str__(self):
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
  1197
                return _("Cannot search a repository before or after itself")
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
  1198
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
  1199
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1200
class SelectedRepositoryRemoval(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1201
        """Used to indicate that an attempt to remove the selected repository
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1202
        for a publisher was made."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1203
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1204
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1205
                return _("Cannot remove the selected repository for a "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1206
                    "publisher.")
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1207
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1208
1256
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1209
class SetDisabledPublisherPreferred(PublisherError):
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1210
        """Used to indicate an attempt to set a disabled publisher as the
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1211
        preferred publisher was made."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1212
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1213
        def __str__(self):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 988
diff changeset
  1214
                return _("Publisher '%s' is disabled and cannot be set as the "
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 988
diff changeset
  1215
                    "preferred publisher.") % self.data
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1216
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1217
1256
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1218
class SetPreferredPublisherDisabled(PublisherError):
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1219
        """Used to indicate that an attempt was made to set the preferred
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1220
        publisher as disabled."""
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1221
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1222
        def __str__(self):
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1223
                return _("The preferred publisher may not be disabled."
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1224
                    "  Another publisher must be set as the preferred "
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1225
                    "publisher before this publisher can be disabled.")
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1226
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1227
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1228
class UnknownLegalURI(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1229
        """Used to indicate that no matching legal URI could be found using the
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1230
        provided criteria."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1231
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1232
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1233
                return _("Unknown legal URI '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1234
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1235
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1236
class UnknownPublisher(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1237
        """Used to indicate that no matching publisher could be found using the
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1238
        provided criteria."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1239
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1240
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1241
                return _("Unknown publisher '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1242
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1243
1736
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1244
class UnknownRepositoryPublishers(PublisherError):
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1245
        """Used to indicate that one or more publisher prefixes are unknown by
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1246
        the specified repository."""
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1247
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1248
        def __init__(self, known=EmptyI, unknown=EmptyI, location=None,
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1249
            origins=EmptyI):
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1250
                ApiException.__init__(self)
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1251
                self.known = known
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1252
                self.location = location
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1253
                self.origins = origins
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1254
                self.unknown = unknown
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1255
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1256
        def __str__(self):
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1257
                if self.location:
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1258
                        return _("The repository at %(location)s does not "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1259
                            "contain package data for %(unknown)s; only "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1260
                            "%(known)s.\n\nThis is either because the "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1261
                            "repository location is not valid, or because the "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1262
                            "provided publisher does not match those known by "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1263
                            "the repository.") % {
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1264
                            "unknown": ", ".join(self.unknown),
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1265
                            "location": self.location,
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1266
                            "known": ", ".join(self.known) }
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1267
                if self.origins:
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1268
                        return _("One or more of the repository origin(s) "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1269
                            "listed below contains package data for "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1270
                            "%(known)s; not %(unknown)s:\n\n%(origins)s\n\n"
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1271
                            "This is either because one of the repository "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1272
                            "origins is not valid for this publisher, or "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1273
                            "because the list of known publishers retrieved "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1274
                            "from the repository origin does not match the "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1275
                            "client.") % { "unknown": ", ".join(self.unknown),
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1276
                            "known": ", ".join(self.known),
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1277
                            "origins": "\n".join(str(o) for o in self.origins) }
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1278
                return _("The specified publisher repository does not "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1279
                    "contain any package data for %(unknown)s; only "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1280
                    "%(known)s.") % { "unknown": ", ".join(self.unknown),
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1281
                    "known": ", ".join(self.known) }
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1282
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1283
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1284
class UnknownRelatedURI(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1285
        """Used to indicate that no matching related URI could be found using
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1286
        the provided criteria."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1287
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1288
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1289
                return _("Unknown related URI '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1290
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1291
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1292
class UnknownRepository(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1293
        """Used to indicate that no matching repository could be found using the
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1294
        provided criteria."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1295
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1296
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1297
                return _("Unknown repository '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1298
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1299
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1300
class UnknownRepositoryMirror(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1301
        """Used to indicate that a repository URI could not be found in the
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1302
        list of repository mirrors."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1303
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1304
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1305
                return _("Unknown repository mirror '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1306
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1307
class UnsupportedRepositoryOperation(PublisherError):
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1308
        """The publisher has no active repositories that support the
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1309
        requested operation."""
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1310
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1311
        def __init__(self, pub, operation):
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1312
                ApiException.__init__(self)
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1313
                self.data = None
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1314
                self.kwargs = None
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1315
                self.pub = pub
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1316
                self.op = operation
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1317
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1318
        def __str__(self):
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1319
                return _("Publisher '%s' has no repositories that support the"
1736
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1320
                    " '%s' operation.") % (self.pub, self.op)
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1321
1937
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1322
class UnsupportedSystemRepositoryOperation(PublisherError):
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1323
        """Operating on the SystemRepository using this method is not
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1324
        supported."""
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1325
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1326
        def __str__(self):
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1327
                return _("Can not modify system repository using "
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1328
                    "method '%s'.") % self.data
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1329
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1330
class UnsupportedSystemRepositoryProtocol(PublisherError):
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1331
        """The caller tried to configure a System Repository with a
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1332
        protocol that is not supported."""
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1333
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1334
        def __str__(self):
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1335
                return _("System repository does not support "
be8995c7bb8f 10924 Want ability to communicate over unix sockets
johansen <johansen@opensolaris.org>
parents: 1895
diff changeset
  1336
                    "protocol '%s'.") %  self.data
1736
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1337
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1338
class RepoPubConfigUnavailable(PublisherError):
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1339
        """Used to indicate that the specified repository does not provide
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1340
        publisher configuration information."""
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1341
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1342
        def __init__(self, location=None, pub=None):
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1343
                ApiException.__init__(self)
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1344
                self.location = location
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1345
                self.pub = pub
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1346
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1347
        def __str__(self):
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1348
                if not self.location and not self.pub:
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1349
                        return _("The specified package repository does not "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1350
                            "provide publisher configuration information.")
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1351
                if self.location:
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1352
                        return _("The package repository at %s does not "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1353
                            "provide publisher configuration information or "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1354
                            "the information provided is incomplete.") % \
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1355
                            self.location
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1356
                return _("One of the package repository origins for %s does "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1357
                    "not provide publisher configuration information or the "
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1358
                    "information provided is incomplete.") % self.pub
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1359
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1360
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1361
class UnknownRepositoryOrigin(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1362
        """Used to indicate that a repository URI could not be found in the
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1363
        list of repository origins."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1364
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1365
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1366
                return _("Unknown repository origin '%s'") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1367
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1368
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1369
class UnsupportedRepositoryURI(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1370
        """Used to indicate that the specified repository URI uses an
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1371
        unsupported scheme."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1372
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1373
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1374
                if self.data:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1375
                        scheme = urlparse.urlsplit(self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1376
                            allow_fragments=0)[0]
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1377
                        return _("The URI '%(uri)s' contains an unsupported "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1378
                            "scheme '%(scheme)s'.") % { "uri": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1379
                            "scheme": scheme }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1380
                return _("The specified URI contains an unsupported scheme.")
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1381
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1382
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1383
class UnsupportedRepositoryURIAttribute(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1384
        """Used to indicate that the specified repository URI attribute is not
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1385
        supported for the URI's scheme."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1386
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1387
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1388
                return _("'%(attr)s' is not supported for '%(scheme)s'.") % {
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1389
                    "attr": self.data, "scheme": self._args["scheme"] }
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1390
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1391
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1392
class CertificateError(ApiException):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1393
        """Base exception class for all certificate exceptions."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1394
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1395
        def __init__(self, *args, **kwargs):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1396
                ApiException.__init__(self, *args)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1397
                if args:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1398
                        self.data = args[0]
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1399
                else:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1400
                        self.data = None
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1401
                self._args = kwargs
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1402
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1403
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1404
                return str(self.data)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1405
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1406
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1407
class ExpiredCertificate(CertificateError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1408
        """Used to indicate that a certificate has expired."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1409
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1410
        def __str__(self):
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1411
                publisher = self._args.get("publisher", None)
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1412
                uri = self._args.get("uri", None)
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1413
                if publisher:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1414
                        if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1415
                                return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1416
                                    "'%(pub)s' needed to access '%(uri)s', "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1417
                                    "has expired.  Please install a valid "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1418
                                    "certificate.") % { "cert": self.data,
1130
18c4f3ce0c8c 9223 CertificateErrors during install or update can result in traceback
Shawn Walker <srw@sun.com>
parents: 1100
diff changeset
  1419
                                    "pub": publisher, "uri": uri }
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1420
                        return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1421
                            "'%(pub)s', has expired.  Please install a valid "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1422
                            "certificate.") % { "cert": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1423
                            "pub": publisher }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1424
                if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1425
                        return _("Certificate '%(cert)s', needed to access "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1426
                            "'%(uri)s', has expired.  Please install a valid "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1427
                            "certificate.") % { "cert": self.data, "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1428
                return _("Certificate '%s' has expired.  Please install a "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1429
                    "valid certificate.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1430
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1431
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1432
class ExpiringCertificate(CertificateError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1433
        """Used to indicate that a certificate has expired."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1434
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1435
        def __str__(self):
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1436
                publisher = self._args.get("publisher", None)
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1437
                uri = self._args.get("uri", None)
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1438
                days = self._args.get("days", 0)
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1439
                if publisher:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1440
                        if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1441
                                return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1442
                                    "'%(pub)s', needed to access '%(uri)s', "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1443
                                    "will expire in '%(days)s' days.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1444
                                    "cert": self.data, "pub": publisher,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1445
                                    "uri": uri, "days": days }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1446
                        return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1447
                            "'%(pub)s' will expire in '%(days)s' days.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1448
                            "cert": self.data, "pub": publisher, "days": days }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1449
                if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1450
                        return _("Certificate '%(cert)s', needed to access "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1451
                            "'%(uri)s', will expire in '%(days)s' days.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1452
                            "cert": self.data, "uri": uri, "days": days }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1453
                return _("Certificate '%(cert)s' will expire in "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1454
                    "'%(days)s' days.") % { "cert": self.data, "days": days }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1455
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1456
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1457
class InvalidCertificate(CertificateError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1458
        """Used to indicate that a certificate is invalid."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1459
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1460
        def __str__(self):
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1461
                publisher = self._args.get("publisher", None)
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1462
                uri = self._args.get("uri", None)
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1463
                if publisher:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1464
                        if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1465
                                return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1466
                                    "'%(pub)s', needed to access '%(uri)s', is "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1467
                                    "invalid.") % { "cert": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1468
                                    "pub": publisher, "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1469
                        return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1470
                            "'%(pub)s' is invalid.") % { "cert": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1471
                            "pub": publisher }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1472
                if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1473
                        return _("Certificate '%(cert)s' needed to access "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1474
                            "'%(uri)s' is invalid.") % { "cert": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1475
                            "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1476
                return _("Invalid certificate '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1477
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1478
1254
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1479
class NoSuchKey(CertificateError):
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1480
        """Used to indicate that a key could not be found."""
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1481
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1482
        def __str__(self):
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1483
                publisher = self._args.get("publisher", None)
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1484
                uri = self._args.get("uri", None)
1254
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1485
                if publisher:
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1486
                        if uri:
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1487
                                return _("Unable to locate key '%(key)s' for "
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1488
                                    "publisher '%(pub)s' needed to access "
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1489
                                    "'%(uri)s'.") % { "key": self.data,
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1490
                                    "pub": publisher, "uri": uri }
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1491
                        return _("Unable to locate key '%(key)s' for publisher "
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1492
                            "'%(pub)s'.") % { "key": self.data, "pub": publisher
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1493
                            }
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1494
                if uri:
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1495
                        return _("Unable to locate key '%(key)s' needed to "
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1496
                            "access '%(uri)s'.") % { "key": self.data,
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1497
                            "uri": uri }
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1498
                return _("Unable to locate key '%s'.") % self.data
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1499
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1500
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1501
class NoSuchCertificate(CertificateError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1502
        """Used to indicate that a certificate could not be found."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1503
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1504
        def __str__(self):
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1505
                publisher = self._args.get("publisher", None)
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1506
                uri = self._args.get("uri", None)
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1507
                if publisher:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1508
                        if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1509
                                return _("Unable to locate certificate "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1510
                                    "'%(cert)s' for publisher '%(pub)s' needed "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1511
                                    "to access '%(uri)s'.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1512
                                    "cert": self.data, "pub": publisher,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1513
                                    "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1514
                        return _("Unable to locate certificate '%(cert)s' for "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1515
                            "publisher '%(pub)s'.") % { "cert": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1516
                            "pub": publisher }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1517
                if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1518
                        return _("Unable to locate certificate '%(cert)s' "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1519
                            "needed to access '%(uri)s'.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1520
                            "cert": self.data, "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1521
                return _("Unable to locate certificate '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1522
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1523
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1524
class NotYetValidCertificate(CertificateError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1525
        """Used to indicate that a certificate is not yet valid (future
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1526
        effective date)."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1527
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1528
        def __str__(self):
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1529
                publisher = self._args.get("publisher", None)
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1530
                uri = self._args.get("uri", None)
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1531
                if publisher:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1532
                        if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1533
                                return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1534
                                    "'%(pub)s', needed to access '%(uri)s', "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1535
                                    "has a future effective date.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1536
                                    "cert": self.data, "pub": publisher,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1537
                                    "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1538
                        return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1539
                            "'%(pub)s' has a future effective date.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1540
                            "cert": self.data, "pub": publisher }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1541
                if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1542
                        return _("Certificate '%(cert)s' needed to access "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1543
                            "'%(uri)s' has a future effective date.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1544
                            "cert": self.data, "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1545
                return _("Certificate '%s' has a future effective date.") % \
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1546
                    self.data
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1547
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1548
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1549
class ServerReturnError(ApiException):
1100
22a8b08d460a 7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents: 1087
diff changeset
  1550
        """This exception is used when the server reutrns a line which the
22a8b08d460a 7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents: 1087
diff changeset
  1551
        client cannot parse correctly."""
22a8b08d460a 7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents: 1087
diff changeset
  1552
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1553
        def __init__(self, line):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1554
                ApiException.__init__(self)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1555
                self.line = line
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1556
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1557
        def __str__(self):
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
  1558
                return _("Gave a bad response:%s") % self.line
1337
52e101b7cc31 9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents: 1335
diff changeset
  1559
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1560
1337
52e101b7cc31 9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents: 1335
diff changeset
  1561
class MissingFileArgumentException(ApiException):
52e101b7cc31 9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents: 1335
diff changeset
  1562
        """This exception is used when a file was given as an argument but
52e101b7cc31 9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents: 1335
diff changeset
  1563
        no such file could be found."""
52e101b7cc31 9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents: 1335
diff changeset
  1564
        def __init__(self, path):
52e101b7cc31 9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents: 1335
diff changeset
  1565
                ApiException.__init__(self)
52e101b7cc31 9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents: 1335
diff changeset
  1566
                self.path = path
52e101b7cc31 9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents: 1335
diff changeset
  1567
52e101b7cc31 9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents: 1335
diff changeset
  1568
        def __str__(self):
52e101b7cc31 9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents: 1335
diff changeset
  1569
                return _("Could not find %s") % self.path
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1570
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1571
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1572
class ManifestError(ApiException):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1573
        """Base exception class for all manifest exceptions."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1574
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1575
        def __init__(self, *args, **kwargs):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1576
                ApiException.__init__(self, *args, **kwargs)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1577
                if args:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1578
                        self.data = args[0]
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1579
                else:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1580
                        self.data = None
1516
8c950a3b4171 10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents: 1505
diff changeset
  1581
                self._args = kwargs
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1582
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1583
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1584
                return str(self.data)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1585
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1586
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1587
class BadManifestSignatures(ManifestError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1588
        """Used to indicate that the Manifest signatures are not valid."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1589
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1590
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1591
                if self.data:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1592
                        return _("The signature data for the manifest of the "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1593
                            "'%s' package is not valid.") % self.data
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1594
                return _("The signature data for the manifest is not valid.")
1370
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1595
1736
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1596
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1597
class UnknownErrors(ApiException):
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1598
        """Used to indicate that one or more exceptions were encountered.
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1599
        This is intended for use with where multiple exceptions for multiple
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1600
        files are encountered and the errors have been condensed into a
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1601
        single exception and re-raised.  One example case would be rmtree()
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1602
        with shutil.Error."""
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1603
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1604
        def __init__(self, msg):
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1605
                ApiException.__init__(self)
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1606
                self.__msg = msg
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1607
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1608
        def __str__(self):
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1609
                return self.__msg
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1610
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1611
1370
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1612
# Image creation exceptions
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1613
class ImageCreationException(ApiException):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1614
        def __init__(self, path):
1736
727dda1e7968 11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents: 1710
diff changeset
  1615
                ApiException.__init__(self)
1370
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1616
                self.path = path
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1617
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1618
        def __str__(self):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1619
                raise NotImplementedError()
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1620
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1621
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1622
class ImageAlreadyExists(ImageCreationException):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1623
        def __str__(self):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1624
                return _("there is already an image at: %s.\nTo override, use "
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1625
                    "the -f (force) option.") % self.path
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1626
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1627
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1628
class CreatingImageInNonEmptyDir(ImageCreationException):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1629
        def __str__(self):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1630
                return _("the specified image path is not empty: %s.\nTo "
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1631
                    "override, use the -f (force) option.") % self.path