src/modules/client/api_errors.py
author Bart Smaalders <Bart.Smaalders@Sun.COM>
Wed, 18 Nov 2009 15:53:48 -0800
changeset 1505 cc598d70bbbe
parent 1504 265a1d6b86bd
child 1516 8c950a3b4171
permissions -rw-r--r--
4425 pkg install should deal w/ complex dependency changes in one install 12018 Implement Facets 12046 Implement publisher search order proposal 12050 Implement Exclude type dependency 762 Dead code in cfgfiles.py? 2606 expanded dependency version specification capability desired 3096 install and uninstall of multiple matches doesn't seem to work 5015 newest package version not installed by depend action with type=require 6018 image-update fails to update optional dependency 7394 package operation failure misleading when mixing build versions 8535 pkgsend in testutils should not fork 8988 nested incorporations fail with IndexError 9030 image-update fails when package constrained by two incorporations 9242 gcc-dev, ss-dev, etc. should be constrained by entire 9294 uninstall should not remove symlinks still used by another package 10922 Image.repair() doesn't set self.imageplan, leading to traceback on "pkg fix" 11681 fmri object should include publisher in hash 11697 pkg dumps stack traceback when --be-name argument contains '+' character 12120 -n operations (install, image-update, etc) w/o -v can skip retrieving manifests 12121 filters have been obsoleted by variants & facets and should be removed. 12455 pkg needs additional exit status codes 12551 imageplan should use manifest prefetch facility introduced in 1472:c50eb141435a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     1
#!/usr/bin/python2.4
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
#
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
    24
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    25
# Use is subject to license terms.
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    26
#
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    27
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
    28
import os
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    29
import urlparse
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    30
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    31
# 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
    32
# dependency.
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
    33
EmptyI = tuple()
838
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
    34
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    35
class ApiException(Exception):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    36
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    37
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    38
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
    39
        """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
    40
        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
    41
                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
    42
                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
    43
                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
    44
                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
    45
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    46
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
    47
        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
    48
                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
    49
                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
    50
                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
    51
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    52
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
    53
        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
    54
                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
    55
                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
    56
1019
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
    57
class ActuatorException(ApiException):
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
    58
        def __init__(self, e):
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
    59
                ApiException.__init__(self)
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
    60
                self.exception = e
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
    61
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
    62
        def __str__(self):
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
    63
                return str(self.exception)
e61c57c724c9 7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 996
diff changeset
    64
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    65
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
    66
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    67
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    68
class AlreadyPreparedException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    69
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    70
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    71
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
    72
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    73
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    74
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
    75
        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
    76
                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
    77
                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
    78
1369
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
    79
1372
484408dfa0a1 11483 ImagePkgStateError needs correction
Shawn Walker <srw@sun.com>
parents: 1370
diff changeset
    80
class ImagePkgStateError(ApiException):
1369
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
    81
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
    82
        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
    83
                ApiException.__init__(self)
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
    84
                self.fmri = fmri
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
    85
                self.states = states
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
    86
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
    87
        def __str__(self):
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
    88
                return _("Invalid package state change attempted '%(states)s' "
1372
484408dfa0a1 11483 ImagePkgStateError needs correction
Shawn Walker <srw@sun.com>
parents: 1370
diff changeset
    89
                    "for package '%(fmri)s'.") % { "states": self.states,
484408dfa0a1 11483 ImagePkgStateError needs correction
Shawn Walker <srw@sun.com>
parents: 1370
diff changeset
    90
                    "fmri": self.fmri }
1369
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
    91
e86145680c34 11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
    92
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    93
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
    94
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    95
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    96
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
    97
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    98
1328
5c3747a4fe0a 9387 pkg fix should honor reboot-needed flag
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1286
diff changeset
    99
class RebootNeededOnLiveImageException(ApiException):
5c3747a4fe0a 9387 pkg fix should honor reboot-needed flag
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1286
diff changeset
   100
        pass
5c3747a4fe0a 9387 pkg fix should honor reboot-needed flag
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1286
diff changeset
   101
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   102
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
   103
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   104
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   105
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
   106
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   107
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   108
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
   109
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   110
685
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   111
class PermissionsException(ApiException):
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   112
        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
   113
                ApiException.__init__(self)
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   114
                self.path = path
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   115
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   116
        def __str__(self):
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   117
                if self.path:
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   118
                        return _("Could not operate on %s\nbecause of "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   119
                            "insufficient permissions. Please try the command "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   120
                            "again using pfexec\nor otherwise increase your "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   121
                            "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
   122
                else:
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   123
                        return _("""
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   124
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
   125
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
   126
""")
6f53483db920 1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents: 655
diff changeset
   127
879
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   128
class FileInUseException(PermissionsException):
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   129
        def __init__(self, path):
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   130
                PermissionsException.__init__(self, path)
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   131
                assert path
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   132
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   133
        def __str__(self):
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   134
                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
   135
                    "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
   136
                    "operation again.") % self.path
3e4622a4c074 2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents: 838
diff changeset
   137
1335
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   138
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   139
class ReadOnlyFileSystemException(PermissionsException):
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   140
        """Used to indicate that the operation was attempted on a 
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   141
        read-only filesystem"""
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   142
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   143
        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
   144
                ApiException.__init__(self)
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   145
                self.path = path
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   146
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   147
        def __str__(self):
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   148
                if self.path:
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   149
                        return _("Could not complete the operation on %s: "
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   150
                            "read-only filesystem\n") % self.path
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   151
                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
   152
                        "filesystem.")
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   153
3dde2385d05c 516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents: 1328
diff changeset
   154
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   155
class PlanCreationException(ApiException):
1141
a74d6815a7fc 4178 unfound_fmris is a poor name
Rich Burridge <rich.burridge@sun.com>
parents: 1130
diff changeset
   156
        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
   157
            missing_matches=EmptyI, illegal=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
   158
            badarch=EmptyI, installed=EmptyI, multispec=EmptyI, 
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   159
            no_solution=False, no_version=EmptyI, missing_dependency=EmptyI, 
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   160
            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
   161
                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
   162
                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
   163
                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
   164
                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
   165
                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
   166
                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
   167
                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
   168
                self.multispec             = multispec
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1431
diff changeset
   169
                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
   170
                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
   171
                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
   172
                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
   173
                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
   174
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   175
        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
   176
                res = []
1141
a74d6815a7fc 4178 unfound_fmris is a poor name
Rich Burridge <rich.burridge@sun.com>
parents: 1130
diff changeset
   177
                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
   178
                        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
   179
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
   180
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
   181
                        res += [s]
1141
a74d6815a7fc 4178 unfound_fmris is a poor name
Rich Burridge <rich.burridge@sun.com>
parents: 1130
diff changeset
   182
                        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
   183
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   184
                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
   185
                        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
   186
                            "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
   187
                            "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
   188
                        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
   189
                        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
   190
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   191
                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
   192
                        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
   193
                        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
   194
                                res.append(s % p)
0074b10d84e0 6874 stack trace on install with ambiguous package names
Danek Duvall <danek.duvall@sun.com>
parents: 917
diff changeset
   195
                                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
   196
                                        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
   197
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   198
                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
   199
                        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
   200
                        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
   201
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   202
                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
   203
                        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
   204
                        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
   205
838
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
   206
                if self.badarch:
aafbe4737188 3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 835
diff changeset
   207
                        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
   208
                        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
   209
                        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
   210
                            ", ".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
   211
                        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
   212
1461
fdf40c8c6765 820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents: 1431
diff changeset
   213
                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
   214
                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
   215
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   216
                if self.installed:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   217
                        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
   218
                            "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
   219
                            "installed: ")
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   220
                        res += [s]
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   221
                        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
   222
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   223
                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
   224
                        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
   225
                              "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
   226
                        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
   227
                        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
   228
                                res += [
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   229
                                        ", ".join(
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   230
                                        [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
   231
                                        + ": %s" % t[0]
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   232
                                        ] 
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   233
                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
   234
                        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
   235
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   236
                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
   237
                        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
   238
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   239
                if self.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
   240
                        res += _("Package %s is missing a dependency: %s" % self.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
   241
                        
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   242
                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
   243
1068
9400aa8afd32 2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents: 1053
diff changeset
   244
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
   245
class ActionExecutionError(ApiException):
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
   246
        """An error was encountered executing an action.
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
   247
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
   248
        In particular, this exception indicates that something went wrong in the
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
   249
        application (or unapplication) of the action to the system, not an error
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
   250
        in the pkg(5) code.
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
   251
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
   252
        The 'msg' argument can provide a more specific message than what would
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
   253
        be returned from, and 'ignoreerrno' can be set to True to indicate that
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
   254
        the sterror() text is misleading, and shouldn't be displayed.
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
   255
        """
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
   256
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
   257
        def __init__(self, action, exception, msg=None, ignoreerrno=False):
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
   258
                self.action = action
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
   259
                self.exception = exception
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
   260
                self.msg = msg
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
   261
                self.ignoreerrno = ignoreerrno
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
   262
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
   263
        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
   264
                errno = ""
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
   265
                if not self.ignoreerrno and hasattr(self.exception, "errno"):
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
   266
                        errno = "[errno %d: %s]" % (self.exception.errno,
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
   267
                            os.strerror(self.exception.errno))
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
   268
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
   269
                msg = self.msg or ""
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
   270
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
   271
                # 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
   272
                # useful.
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
   273
                if not errno and not msg:
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
   274
                        return str(self.exception)
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
   275
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
   276
                if errno and msg:
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
   277
                        return "%s: %s" % (errno, msg)
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
   278
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
   279
                # If we only have one of the two, no need for the colon.
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
   280
                return "%s%s" % (errno, msg)
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
   281
1068
9400aa8afd32 2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents: 1053
diff changeset
   282
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   283
class CatalogRefreshException(ApiException):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   284
        def __init__(self, failed, total, succeeded, message=None):
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   285
                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
   286
                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
   287
                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
   288
                self.succeeded = succeeded
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   289
                self.message = message
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   290
1068
9400aa8afd32 2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents: 1053
diff changeset
   291
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   292
class CatalogError(ApiException):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   293
        """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
   294
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   295
        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
   296
                ApiException.__init__(self)
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   297
                if args:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   298
                        self.data = args[0]
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   299
                else:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   300
                        self.data = None
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   301
                self.args = kwargs
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   302
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   303
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   304
                return str(self.data)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   305
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   306
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   307
class AnarchicalCatalogFMRI(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   308
        """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
   309
        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
   310
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   311
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   312
                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
   313
                    "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
   314
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   315
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   316
class BadCatalogMetaRoot(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   317
        """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
   318
        because the meta_root is invalid."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   319
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   320
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   321
                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
   322
                    "to complete operation: '%(op)s'.") % { "root": self.data,
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   323
                    "op": self.args.get("operation", None) }
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   324
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   325
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   326
class BadCatalogPermissions(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   327
        """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
   328
        permissions."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   329
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   330
        def __init__(self, files):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   331
                """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
   332
                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
   333
                if not files:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   334
                        files = []
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   335
                CatalogError.__init__(self, files)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   336
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   337
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   338
                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
   339
                    "permissions:\n")
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   340
                for f in self.args:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   341
                        fname, emode, fmode = f
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   342
                        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
   343
                            "mode: %(fmode)s\n") % { "fname": fname,
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   344
                            "emode": emode, "fmode": fmode }
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   345
                return msg
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   346
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   347
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   348
class BadCatalogSignatures(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   349
        """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
   350
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   351
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   352
                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
   353
                    "valid.") % self.data
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   354
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   355
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   356
class BadCatalogUpdateIdentity(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   357
        """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
   358
        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
   359
        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
   360
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   361
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   362
                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
   363
                    "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
   364
                    "update data in '%s'.") % self.data
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   365
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   366
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   367
class DuplicateCatalogEntry(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   368
        """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
   369
        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
   370
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   371
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   372
                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
   373
                    "%(name)s; completion would result in a duplicate entry "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   374
                    "for package '%(fmri)s'.") % { "op": self.args.get(
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   375
                    "operation", None), "name": self.args.get("catalog_name",
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   376
                    None), "fmri": self.data }
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   377
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   378
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   379
class CatalogUpdateRequirements(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   380
        """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
   381
        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
   382
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   383
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   384
                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
   385
                    "catalog.")
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   386
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   387
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   388
class InvalidCatalogFile(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   389
        """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
   390
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   391
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   392
                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
   393
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   394
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   395
class ObsoleteCatalogUpdate(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   396
        """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
   397
        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
   398
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   399
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   400
                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
   401
                    "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
   402
                    "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
   403
                    "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
   404
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   405
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   406
class UnknownCatalogEntry(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   407
        """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
   408
        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
   409
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   410
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   411
                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
   412
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   413
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   414
class UnknownUpdateType(CatalogError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   415
        """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
   416
        unknown."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   417
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   418
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   419
                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
   420
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   421
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   422
class UnrecognizedCatalogPart(CatalogError):
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   423
        """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
   424
        or invalid."""
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   425
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   426
        def __str__(self):
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   427
                return _("Unrecognized, unknown, or invalid CatalogPart '%s'") \
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   428
                    % self.data
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   429
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
   430
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   431
class InventoryException(ApiException):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   432
        """Used to indicate that some of the specified patterns to a catalog
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   433
        matching function did not match any catalog entries."""
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   434
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   435
        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
   436
            publisher=EmptyI, version=EmptyI):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   437
                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
   438
                self.illegal = illegal
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   439
                self.matcher = matcher
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   440
                self.notfound = set(notfound)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   441
                self.publisher = publisher
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   442
                self.version = version
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   443
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   444
                self.notfound.update(matcher)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   445
                self.notfound.update(publisher)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   446
                self.notfound.update(version)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   447
                self.notfound = list(self.notfound)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   448
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   449
                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
   450
596
f4519e2a99bc 3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 565
diff changeset
   451
        def __str__(self):
f4519e2a99bc 3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 565
diff changeset
   452
                outstr = ""
f4519e2a99bc 3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 565
diff changeset
   453
                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
   454
                        # 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
   455
                        outstr += "%s\n" % x
614
4b620a1e8c01 4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 596
diff changeset
   456
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   457
                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
   458
                        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
   459
                            "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
   460
                            "the current publishers:\n")
614
4b620a1e8c01 4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 596
diff changeset
   461
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   462
                        for x in self.matcher:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   463
                                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
   464
                        for x in self.publisher:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   465
                                outstr += _("%s (publisher did not "
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   466
                                    "match)\n") % x
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   467
                        for x in self.version:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
   468
                                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
   469
                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
   470
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   471
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   472
# SearchExceptions
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   473
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   474
class SearchException(ApiException):
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   475
        """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
   476
        pass
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   477
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   478
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   479
class MainDictParsingException(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   480
        """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
   481
        def __init__(self, e):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   482
                SearchException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   483
                self.e = e
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   484
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   485
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   486
                return str(self.e)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   487
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   488
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   489
class MalformedSearchRequest(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   490
        """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
   491
        search request."""
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   492
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   493
        def __init__(self, url):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   494
                SearchException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   495
                self.url = url
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   496
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   497
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   498
                return str(self.url)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   499
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   500
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   501
class NegativeSearchResult(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   502
        """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
   503
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   504
        def __init__(self, url):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   505
                SearchException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   506
                self.url = url
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   507
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   508
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   509
                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
   510
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   511
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   512
class ProblematicSearchServers(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   513
        """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
   514
        do a search request."""
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   515
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   516
        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
   517
                SearchException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   518
                self.failed_servers = failed
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   519
                self.invalid_servers  = invalid
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   520
                self.unsupported_servers = unsupported
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   521
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   522
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   523
                s = _("Some servers failed to respond appropriately:\n")
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   524
                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
   525
                        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
   526
                            { "o": pub, "msg": err}
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   527
                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
   528
                        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
   529
                            % pub)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   530
                if len(self.unsupported_servers) > 0:
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   531
                        s += _("Some servers don't support requested search"
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   532
                            " operation:\n")
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   533
                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
   534
                        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
   535
                            { "o": pub, "msg": err}
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   536
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   537
                return s
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   538
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   539
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   540
class SlowSearchUsed(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   541
        """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
   542
        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
   543
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   544
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   545
                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
   546
                    "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
   547
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   548
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   549
class UnsupportedSearchError(SearchException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   550
        """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
   551
        remote server."""
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   552
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   553
        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
   554
                SearchException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   555
                self.url = url
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   556
                self.proto = proto
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   557
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   558
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   559
                s = _("Search server does not support the requested protocol:")
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   560
                if self.url:
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   561
                        s += "\nServer URL: %s" % self.url
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   562
                if self.proto:
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   563
                        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
   564
                return s
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   565
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   566
        def __cmp__(self, other):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   567
                if not isinstance(other, UnsupportedSearchError):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   568
                        return -1        
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   569
                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
   570
                if r != 0:
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   571
                        return r
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   572
                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
   573
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   574
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   575
# IndexingExceptions.
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   576
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   577
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
   578
        """ 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
   579
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   580
        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
   581
                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
   582
                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
   583
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   584
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   585
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
   586
        """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
   587
        pass
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   588
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   589
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   590
class InconsistentIndexException(IndexingException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   591
        """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
   592
        versions."""
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   593
        def __init__(self, e):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   594
                IndexingException.__init__(self, e)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   595
                self.exception = e
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   596
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   597
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   598
                return str(self.exception)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   599
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   600
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   601
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
   602
        """ 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
   603
        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
   604
        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
   605
                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
   606
                    "%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
   607
                    "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
   608
                    "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
   609
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
   610
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
   611
        """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
   612
        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
   613
        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
   614
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   615
        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
   616
                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
   617
                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
   618
                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
   619
                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
   620
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   621
        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
   622
                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
   623
                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
   624
                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
   625
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   626
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   627
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
   628
        """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
   629
        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
   630
        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
   631
        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
   632
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1256
diff changeset
   633
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   634
# Query Parsing Exceptions
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   635
class BooleanQueryException(ApiException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   636
        """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
   637
        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
   638
        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
   639
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   640
        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
   641
                ApiException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   642
                self.e = e
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   643
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   644
        def __str__(self):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   645
                return str(self.e)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   646
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   647
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   648
class ParseError(ApiException):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   649
        def __init__(self, e):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   650
                ApiException.__init__(self)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   651
                self.e = e
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   652
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   653
        def __str__(self):
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   654
                return str(self.e)
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
   655
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   656
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   657
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
   658
        """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
   659
565
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   660
        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
   661
        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
   662
        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
   663
        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
   664
        """
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   665
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   666
        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
   667
                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
   668
1fb4f05220b9 3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   669
                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
   670
                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
   671
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
   672
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
   673
        """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
   674
        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
   675
        def __init__(self, url, data):
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   676
                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
   677
                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
   678
                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
   679
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
   680
        def __str__(self):
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
   681
                s = "Unable to contact valid package server"
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
   682
                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
   683
                        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
   684
                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
   685
                        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
   686
                            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
   687
                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
   688
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   689
class DataError(ApiException):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   690
        """Base exception class used for all data related errors."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   691
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   692
        def __init__(self, *args, **kwargs):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   693
                ApiException.__init__(self, *args)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   694
                if args:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   695
                        self.data = args[0]
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   696
                else:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   697
                        self.data = None
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   698
                self.args = kwargs
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   699
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   700
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   701
class InvalidP5IFile(DataError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   702
        """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
   703
        valid p5i-formatted file."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   704
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   705
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   706
                if self.data:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   707
                        return _("The specified file is in an unrecognized "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   708
                            "format or does not contain valid publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   709
                            "information: %s") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   710
                return _("The specified file is in an unrecognized format or "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   711
                    "does not contain valid publisher information.")
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   712
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   713
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   714
class UnsupportedP5IFile(DataError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   715
        """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
   716
        of pkg(5) info file was attempted."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   717
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   718
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   719
                return _("Unsupported pkg(5) publisher information data "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   720
                    "format.")
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   721
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   722
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   723
class TransportError(ApiException):
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   724
        """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
   725
        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
   726
        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
   727
        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
   728
        defined here that raise NotImplementedError."""
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   729
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   730
        def __str__(self):
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   731
                raise NotImplementedError
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   732
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   733
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   734
class RetrievalError(ApiException):
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   735
        """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
   736
        retrieved."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   737
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   738
        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
   739
                ApiException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   740
                self.data = data
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   741
                self.location = location
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   742
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   743
        def __str__(self):
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   744
                if self.location:
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   745
                        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
   746
                            "'%s':\n%s") % (self.location, self.data)
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   747
                return _("Error encountered while retrieving data from: %s") % \
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   748
                    self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   749
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   750
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   751
class InvalidResourceLocation(ApiException):
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   752
        """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
   753
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   754
        def __init__(self, data):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   755
                ApiException.__init__(self)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   756
                self.data = data
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1182
diff changeset
   757
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   758
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   759
                return _("'%s' is not a valid location.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   760
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   761
class BEException(ApiException):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   762
        def __init__(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   763
                ApiException.__init__(self)
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   764
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
   765
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
   766
        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
   767
                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
   768
                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
   769
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
   770
        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
   771
                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
   772
                    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
   773
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
   774
class DuplicateBEName(BEException):
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
   775
        """Used to indicate that there is an existing boot environment 
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
   776
        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
   777
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
   778
        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
   779
                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
   780
                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
   781
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
   782
        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
   783
                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
   784
                    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
   785
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
   786
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
   787
        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
   788
                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
   789
                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
   790
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
   791
        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
   792
                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
   793
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
   794
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
   795
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
   796
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
   797
        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
   798
                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
   799
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
   800
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
   801
        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
   802
                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
   803
                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
   804
                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
   805
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
   806
        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
   807
                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
   808
                    "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
   809
                    "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
   810
                }
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
   811
                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
   812
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
   813
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
   814
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
   815
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
   816
        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
   817
                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
   818
                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
   819
                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
   820
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
   821
        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
   822
                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
   823
                    {"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
   824
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
   825
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
   826
        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
   827
                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
   828
                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
   829
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
   830
        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
   831
                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
   832
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
   833
not allowed.""")
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   834
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   835
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
   836
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
   837
        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
   838
                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
   839
                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
   840
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
   841
        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
   842
                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
   843
                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
   844
                        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
   845
                return s
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   846
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   847
class IncorrectIndexFileHash(ApiException):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   848
        """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
   849
        packages installed in the image."""
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   850
        pass
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   851
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
   852
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   853
class PublisherError(ApiException):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   854
        """Base exception class for all publisher exceptions."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   855
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   856
        def __init__(self, *args, **kwargs):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   857
                ApiException.__init__(self, *args)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   858
                if args:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   859
                        self.data = args[0]
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   860
                else:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   861
                        self.data = None
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   862
                self.args = kwargs
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   863
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   864
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   865
                return str(self.data)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   866
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   867
1087
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
   868
class BadPublisherMetaRoot(PublisherError):
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
   869
        """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
   870
        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
   871
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
   872
        def __str__(self):
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
   873
                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
   874
                    "to complete operation: '%(op)s'.") % { "root": self.data,
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
   875
                    "op": self.args.get("operation", None) }
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
   876
293c0aa5f32e 8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents: 1076
diff changeset
   877
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   878
class BadPublisherPrefix(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   879
        """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
   880
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   881
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   882
                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
   883
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   884
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   885
class BadRepositoryAttributeValue(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   886
        """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
   887
        invalid."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   888
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   889
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   890
                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
   891
                    "attribute '%(attribute)s'.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   892
                    "value": self.args["value"], "attribute": self.data }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   893
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
class BadRepositoryCollectionType(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   896
        """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
   897
        invalid."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   898
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   899
        def __init__(self, *args, **kwargs):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   900
                PublisherError.__init__(self, *args, **kwargs)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   901
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   902
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   903
                return _("'%s' is not a valid repository collection type.") % \
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   904
                    self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   905
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   906
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   907
class BadRepositoryURI(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   908
        """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
   909
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   910
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   911
                return _("'%s' is not a valid URI.") % self.data
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
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   914
class BadRepositoryURIPriority(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   915
        """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
   916
        not valid."""
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
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   919
                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
   920
                    "expected.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   921
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   922
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   923
class BadRepositoryURISortPolicy(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   924
        """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
   925
        invalid."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   927
        def __init__(self, *args, **kwargs):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   928
                PublisherError.__init__(self, *args, **kwargs)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   929
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   930
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   931
                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
   932
                    self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   933
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   934
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   935
class DisabledPublisher(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   936
        """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
   937
        during an operation."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   938
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   939
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   940
                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
   941
                    "packaging operations.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   942
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   943
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   944
class DuplicatePublisher(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   945
        """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
   946
        exists for an image."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   947
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   948
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   949
                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
   950
                    "already exists.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   951
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   952
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   953
class DuplicateRepository(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   954
        """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
   955
        already exists for a publisher."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   956
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   957
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   958
                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
   959
                   "already exists for publisher '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   960
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   961
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   962
class DuplicateRepositoryMirror(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   963
        """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
   964
        repository mirror."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   965
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   966
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   967
                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
   968
                    "publisher.") % self.data
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   969
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   970
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   971
class DuplicateRepositoryOrigin(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   972
        """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
   973
        repository origin."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   974
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   975
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   976
                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
   977
                    "publisher.") % self.data
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
   978
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
   979
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
   980
class PublisherOriginRequired(PublisherError):
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
   981
        """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
   982
        repository with at least one origin URI."""
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
   983
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
   984
        def __str__(self):
265a1d6b86bd 9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents: 1461
diff changeset
   985
                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
   986
                "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
   987
                "origin(s).") % self.data
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   988
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   989
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   990
class RemovePreferredPublisher(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   991
        """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
   992
        made."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   993
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   994
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   995
                return _("The preferred publisher cannot be removed.")
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   996
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
   997
1505
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
   998
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
   999
        """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
  1000
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
  1001
        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
  1002
                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
  1003
cc598d70bbbe 4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents: 1504
diff changeset
  1004
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1005
class SelectedRepositoryRemoval(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1006
        """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
  1007
        for a publisher was made."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1008
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1009
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1010
                return _("Cannot remove the selected repository for a "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1011
                    "publisher.")
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1012
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1013
1256
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1014
class SetDisabledPublisherPreferred(PublisherError):
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1015
        """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
  1016
        preferred publisher was made."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1017
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1018
        def __str__(self):
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 988
diff changeset
  1019
                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
  1020
                    "preferred publisher.") % self.data
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1021
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1022
1256
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1023
class SetPreferredPublisherDisabled(PublisherError):
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1024
        """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
  1025
        publisher as disabled."""
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1026
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1027
        def __str__(self):
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1028
                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
  1029
                    "  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
  1030
                    "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
  1031
921590dc232b 8863 error message unclear when trying to disable preferred publisher
Shawn Walker <srw@sun.com>
parents: 1254
diff changeset
  1032
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1033
class UnknownLegalURI(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1034
        """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
  1035
        provided criteria."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1036
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1037
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1038
                return _("Unknown legal URI '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1039
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1040
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1041
class UnknownPublisher(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1042
        """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
  1043
        provided criteria."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1044
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1045
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1046
                return _("Unknown publisher '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1047
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1048
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1049
class UnknownRelatedURI(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1050
        """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
  1051
        the provided criteria."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1052
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1053
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1054
                return _("Unknown related URI '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1055
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1056
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1057
class UnknownRepository(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1058
        """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
  1059
        provided criteria."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1060
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1061
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1062
                return _("Unknown repository '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1063
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1064
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1065
class UnknownRepositoryMirror(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1066
        """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
  1067
        list of repository mirrors."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1068
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1069
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1070
                return _("Unknown repository mirror '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1071
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1072
class UnsupportedRepositoryOperation(PublisherError):
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1073
        """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
  1074
        requested operation."""
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1075
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1076
        def __init__(self, pub, operation):
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1077
                ApiException.__init__(self)
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1078
                self.data = None
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1079
                self.kwargs = None
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1080
                self.pub = pub
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1081
                self.op = operation
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1082
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1083
        def __str__(self):
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1084
                return _("Publisher '%s' has no repositories that support the"
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1372
diff changeset
  1085
                    " '%s' operation.") % (self.pub.prefix, self.op)
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1086
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1087
class UnknownRepositoryOrigin(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1088
        """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
  1089
        list of repository origins."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1090
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1091
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1092
                return _("Unknown repository origin '%s'") % self.data
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
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1095
class UnsupportedRepositoryURI(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1096
        """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
  1097
        unsupported scheme."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1098
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1099
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1100
                if self.data:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1101
                        scheme = urlparse.urlsplit(self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1102
                            allow_fragments=0)[0]
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1103
                        return _("The URI '%(uri)s' contains an unsupported "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1104
                            "scheme '%(scheme)s'.") % { "uri": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1105
                            "scheme": scheme }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1106
                return _("The specified URI contains an unsupported scheme.")
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 UnsupportedRepositoryURIAttribute(PublisherError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1110
        """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
  1111
        supported for the URI's scheme."""
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 _("'%(attr)s' is not supported for '%(scheme)s'.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1115
                    "attr": self.data, "scheme": self.args["scheme"] }
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 CertificateError(ApiException):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1119
        """Base exception class for all certificate exceptions."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1120
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1121
        def __init__(self, *args, **kwargs):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1122
                ApiException.__init__(self, *args)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1123
                if args:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1124
                        self.data = args[0]
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1125
                else:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1126
                        self.data = None
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1127
                self.args = kwargs
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
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1130
                return str(self.data)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1131
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1132
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1133
class ExpiredCertificate(CertificateError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1134
        """Used to indicate that a certificate has expired."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1135
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1136
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1137
                publisher = self.args.get("publisher", None)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1138
                uri = self.args.get("uri", None)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1139
                if publisher:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1140
                        if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1141
                                return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1142
                                    "'%(pub)s' needed to access '%(uri)s', "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1143
                                    "has expired.  Please install a valid "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1144
                                    "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
  1145
                                    "pub": publisher, "uri": uri }
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1146
                        return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1147
                            "'%(pub)s', has expired.  Please install a valid "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1148
                            "certificate.") % { "cert": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1149
                            "pub": publisher }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1150
                if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1151
                        return _("Certificate '%(cert)s', needed to access "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1152
                            "'%(uri)s', has expired.  Please install a valid "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1153
                            "certificate.") % { "cert": self.data, "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1154
                return _("Certificate '%s' has expired.  Please install a "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1155
                    "valid certificate.") % self.data
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
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1158
class ExpiringCertificate(CertificateError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1159
        """Used to indicate that a certificate has expired."""
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
                publisher = self.args.get("publisher", None)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1163
                uri = self.args.get("uri", None)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1164
                days = self.args.get("days", 0)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1165
                if publisher:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1166
                        if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1167
                                return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1168
                                    "'%(pub)s', needed to access '%(uri)s', "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1169
                                    "will expire in '%(days)s' days.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1170
                                    "cert": self.data, "pub": publisher,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1171
                                    "uri": uri, "days": days }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1172
                        return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1173
                            "'%(pub)s' will expire in '%(days)s' days.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1174
                            "cert": self.data, "pub": publisher, "days": days }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1175
                if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1176
                        return _("Certificate '%(cert)s', needed to access "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1177
                            "'%(uri)s', will expire in '%(days)s' days.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1178
                            "cert": self.data, "uri": uri, "days": days }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1179
                return _("Certificate '%(cert)s' will expire in "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1180
                    "'%(days)s' days.") % { "cert": self.data, "days": days }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1181
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1182
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1183
class InvalidCertificate(CertificateError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1184
        """Used to indicate that a certificate is invalid."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1185
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1186
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1187
                publisher = self.args.get("publisher", None)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1188
                uri = self.args.get("uri", None)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1189
                if publisher:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1190
                        if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1191
                                return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1192
                                    "'%(pub)s', needed to access '%(uri)s', is "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1193
                                    "invalid.") % { "cert": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1194
                                    "pub": publisher, "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1195
                        return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1196
                            "'%(pub)s' is invalid.") % { "cert": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1197
                            "pub": publisher }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1198
                if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1199
                        return _("Certificate '%(cert)s' needed to access "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1200
                            "'%(uri)s' is invalid.") % { "cert": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1201
                            "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1202
                return _("Invalid certificate '%s'.") % self.data
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
1254
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1205
class NoSuchKey(CertificateError):
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1206
        """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
  1207
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1208
        def __str__(self):
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1209
                publisher = self.args.get("publisher", None)
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1210
                uri = self.args.get("uri", None)
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1211
                if publisher:
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1212
                        if uri:
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1213
                                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
  1214
                                    "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
  1215
                                    "'%(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
  1216
                                    "pub": publisher, "uri": uri }
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1217
                        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
  1218
                            "'%(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
  1219
                            }
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1220
                if uri:
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1221
                        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
  1222
                            "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
  1223
                            "uri": uri }
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1224
                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
  1225
28871b08d49c 8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents: 1191
diff changeset
  1226
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1227
class NoSuchCertificate(CertificateError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1228
        """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
  1229
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1230
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1231
                publisher = self.args.get("publisher", None)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1232
                uri = self.args.get("uri", None)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1233
                if publisher:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1234
                        if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1235
                                return _("Unable to locate certificate "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1236
                                    "'%(cert)s' for publisher '%(pub)s' needed "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1237
                                    "to access '%(uri)s'.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1238
                                    "cert": self.data, "pub": publisher,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1239
                                    "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1240
                        return _("Unable to locate certificate '%(cert)s' for "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1241
                            "publisher '%(pub)s'.") % { "cert": self.data,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1242
                            "pub": publisher }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1243
                if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1244
                        return _("Unable to locate certificate '%(cert)s' "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1245
                            "needed to access '%(uri)s'.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1246
                            "cert": self.data, "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1247
                return _("Unable to locate certificate '%s'.") % self.data
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1248
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1249
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1250
class NotYetValidCertificate(CertificateError):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1251
        """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
  1252
        effective date)."""
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1253
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1254
        def __str__(self):
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1255
                publisher = self.args.get("publisher", None)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1256
                uri = self.args.get("uri", None)
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1257
                if publisher:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1258
                        if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1259
                                return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1260
                                    "'%(pub)s', needed to access '%(uri)s', "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1261
                                    "has a future effective date.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1262
                                    "cert": self.data, "pub": publisher,
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1263
                                    "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1264
                        return _("Certificate '%(cert)s' for publisher "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1265
                            "'%(pub)s' has a future effective date.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1266
                            "cert": self.data, "pub": publisher }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1267
                if uri:
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1268
                        return _("Certificate '%(cert)s' needed to access "
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1269
                            "'%(uri)s' has a future effective date.") % {
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1270
                            "cert": self.data, "uri": uri }
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1271
                return _("Certificate '%s' has a future effective date.") % \
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 922
diff changeset
  1272
                    self.data
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1273
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1274
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1275
class ServerReturnError(ApiException):
1100
22a8b08d460a 7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents: 1087
diff changeset
  1276
        """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
  1277
        client cannot parse correctly."""
22a8b08d460a 7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents: 1087
diff changeset
  1278
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1279
        def __init__(self, line):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1280
                ApiException.__init__(self)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1281
                self.line = line
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1282
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 926
diff changeset
  1283
        def __str__(self):
1027
e827313523d8 7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents: 1019
diff changeset
  1284
                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
  1285
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1286
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
  1287
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
  1288
        """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
  1289
        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
  1290
        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
  1291
                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
  1292
                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
  1293
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
  1294
        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
  1295
                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
  1296
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1297
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1298
class ManifestError(ApiException):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1299
        """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
  1300
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1301
        def __init__(self, *args, **kwargs):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1302
                ApiException.__init__(self, *args, **kwargs)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1303
                if args:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1304
                        self.data = args[0]
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1305
                else:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1306
                        self.data = None
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1307
                self.args = kwargs
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1308
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1309
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1310
                return str(self.data)
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1311
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1312
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1313
class BadManifestSignatures(ManifestError):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1314
        """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
  1315
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1316
        def __str__(self):
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1317
                if self.data:
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1337
diff changeset
  1318
                        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
  1319
                            "'%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
  1320
                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
  1321
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1322
# Image creation exceptions
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1323
class ImageCreationException(ApiException):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1324
        def __init__(self, path):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1325
                self.path = path
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1326
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1327
        def __str__(self):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1328
                raise NotImplementedError()
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1329
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1330
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1331
class ImageAlreadyExists(ImageCreationException):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1332
        def __str__(self):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1333
                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
  1334
                    "the -f (force) option.") % self.path
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1335
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1336
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1337
class CreatingImageInNonEmptyDir(ImageCreationException):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1338
        def __str__(self):
face1fe579ab 11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents: 1369
diff changeset
  1339
                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
  1340
                    "override, use the -f (force) option.") % self.path