author | Brock Pytlik <bpytlik@sun.com> |
Mon, 04 May 2009 18:32:04 -0700 | |
changeset 1100 | 22a8b08d460a |
parent 1087 | 293c0aa5f32e |
child 1130 | 18c4f3ce0c8c |
permissions | -rw-r--r-- |
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 |
|
1051
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
28 |
import httplib |
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
|
29 |
import os |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
30 |
import socket |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
31 |
import urllib2 |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
32 |
import urlparse |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
33 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
34 |
# 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
|
35 |
# dependency. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
36 |
EmptyI = tuple() |
838
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
37 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
38 |
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
|
39 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
40 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
41 |
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
|
42 |
"""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
|
43 |
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
|
44 |
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
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
49 |
class NetworkUnavailableException(ApiException): |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
50 |
def __init__(self, caught_exception): |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
51 |
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
|
52 |
self.ex = caught_exception |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
53 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
54 |
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
|
55 |
return str(self.ex) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
56 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
57 |
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
|
58 |
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
|
59 |
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
|
60 |
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
|
61 |
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
|
62 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
63 |
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
|
64 |
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
|
65 |
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
|
66 |
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
|
67 |
|
1019
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
68 |
class ActuatorException(ApiException): |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
69 |
def __init__(self, e): |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
70 |
ApiException.__init__(self) |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
71 |
self.exception = e |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
72 |
|
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
73 |
def __str__(self): |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
74 |
return str(self.exception) |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
75 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
76 |
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
|
77 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
78 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
79 |
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
|
80 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
81 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
82 |
class AlreadyExecutedException(ApiException): |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
83 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
84 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
85 |
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
|
86 |
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
|
87 |
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
|
88 |
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
|
89 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
90 |
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
|
91 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
92 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
93 |
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
|
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 CanceledException(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 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
99 |
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
|
100 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
101 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
102 |
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
|
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 |
|
685
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
105 |
class PermissionsException(ApiException): |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
106 |
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
|
107 |
ApiException.__init__(self) |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
108 |
self.path = path |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
109 |
|
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
110 |
def __str__(self): |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
111 |
if self.path: |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
112 |
return _("Could not operate on %s\nbecause of " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
113 |
"insufficient permissions. Please try the command " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
114 |
"again using pfexec\nor otherwise increase your " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
115 |
"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
|
116 |
else: |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
117 |
return _(""" |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
118 |
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
|
119 |
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
|
120 |
""") |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
121 |
|
879
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
122 |
class FileInUseException(PermissionsException): |
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
123 |
def __init__(self, path): |
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
124 |
PermissionsException.__init__(self, path) |
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
125 |
assert path |
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
126 |
|
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
127 |
def __str__(self): |
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
128 |
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
|
129 |
"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
|
130 |
"operation again.") % self.path |
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
131 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
132 |
class PlanCreationException(ApiException): |
838
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
133 |
def __init__(self, unfound_fmris=EmptyI, multiple_matches=EmptyI, |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
134 |
missing_matches=EmptyI, illegal=EmptyI, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
135 |
constraint_violations=EmptyI, badarch=EmptyI): |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
136 |
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
|
137 |
self.unfound_fmris = unfound_fmris |
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
138 |
self.multiple_matches = multiple_matches |
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
139 |
self.missing_matches = missing_matches |
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
140 |
self.illegal = illegal |
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
141 |
self.constraint_violations = constraint_violations |
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
142 |
self.badarch = badarch |
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
143 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
144 |
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
|
145 |
res = [] |
6d307b088d92
4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents:
614
diff
changeset
|
146 |
if self.unfound_fmris: |
6d307b088d92
4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents:
614
diff
changeset
|
147 |
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
|
148 |
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
|
149 |
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
|
150 |
res += [s] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
151 |
res += ["\t%s" % p for p in self.unfound_fmris] |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
152 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
153 |
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
|
154 |
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
|
155 |
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
|
156 |
res.append(s % p) |
0074b10d84e0
6874 stack trace on install with ambiguous package names
Danek Duvall <danek.duvall@sun.com>
parents:
917
diff
changeset
|
157 |
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
|
158 |
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
|
159 |
|
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
|
160 |
s = _("'%s' matches no installed packages") |
616
6d307b088d92
4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents:
614
diff
changeset
|
161 |
res += [ s % p for p in self.missing_matches ] |
6d307b088d92
4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents:
614
diff
changeset
|
162 |
|
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
|
163 |
s = _("'%s' is an illegal fmri") |
616
6d307b088d92
4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents:
614
diff
changeset
|
164 |
res += [ s % p for p in self.illegal ] |
6d307b088d92
4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents:
614
diff
changeset
|
165 |
|
655
6eef82185057
2325 optional dependency enforcement can't handle fmris disappearing from the catalog
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
633
diff
changeset
|
166 |
if self.constraint_violations: |
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
|
167 |
s = _("The following package(s) violated constraints:") |
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
168 |
res += [s] |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
169 |
res += ["\t%s" % p for p in self.constraint_violations] |
655
6eef82185057
2325 optional dependency enforcement can't handle fmris disappearing from the catalog
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
633
diff
changeset
|
170 |
|
838
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
171 |
if self.badarch: |
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
172 |
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
|
173 |
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
|
174 |
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
|
175 |
", ".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
|
176 |
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
|
177 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
178 |
return '\n'.join(res) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
179 |
|
1068
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
180 |
|
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
|
181 |
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
|
182 |
"""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
|
183 |
|
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
|
184 |
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
|
185 |
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
|
186 |
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
|
187 |
|
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
|
188 |
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
|
189 |
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
|
190 |
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
|
191 |
""" |
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
|
192 |
|
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
|
193 |
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
|
194 |
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
|
195 |
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
|
196 |
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
|
197 |
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
|
198 |
|
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
|
199 |
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
|
200 |
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
|
201 |
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
|
202 |
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
|
203 |
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
|
204 |
|
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
|
205 |
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
|
206 |
|
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
|
207 |
# 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
|
208 |
# 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
|
209 |
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
|
210 |
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
|
211 |
|
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
|
212 |
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
|
213 |
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
|
214 |
|
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
|
215 |
# 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
|
216 |
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
|
217 |
|
1068
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
218 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
219 |
class CatalogCacheError(ApiException): |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
220 |
"""Base class used for all catalog cache errors.""" |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
221 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
222 |
def __init__(self, *args, **kwargs): |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
223 |
ApiException.__init__(self, *args) |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
224 |
if args: |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
225 |
self.data = args[0] |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
226 |
else: |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
227 |
self.data = None |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
228 |
self.args = kwargs |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
229 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
230 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
231 |
class CatalogCacheBadVersion(CatalogCacheError): |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
232 |
"""Used to indicate that the catalog cache is invalid or is not of a |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
233 |
supported version.""" |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
234 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
235 |
def __str__(self): |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
236 |
return _("Unsupported catalog cache Version: '%(found)s'; " |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
237 |
"expected: '%(expected)s'") % { "found": self.data, |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
238 |
"expected": self.args["expected"] } |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
239 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
240 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
241 |
class CatalogCacheInvalid(CatalogCacheError): |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
242 |
"""Used to indicate that the catalog cache is corrupt or otherwise |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
243 |
unparseable.""" |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
244 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
245 |
def __str__(self): |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
246 |
return _("Catalog cache is corrupt or invalid; error " |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
247 |
"encountered while reading:\nline %(lnum)d: '%(data)s'") % { |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
248 |
"lnum": self.args["line_number"], "data": self.data } |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
249 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
250 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
251 |
class CatalogCacheMissing(CatalogCacheError): |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
252 |
"""Used to indicate that the catalog cache is missing.""" |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
253 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
254 |
def __str__(self): |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
255 |
return _("Catalog cache is missing.") |
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
256 |
|
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
257 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
258 |
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
|
259 |
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
|
260 |
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
|
261 |
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
|
262 |
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
|
263 |
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
|
264 |
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
|
265 |
|
1068
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
266 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
267 |
class InventoryException(ApiException): |
838
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
268 |
def __init__(self, notfound=EmptyI, illegal=EmptyI): |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
269 |
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
|
270 |
self.notfound = notfound |
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
271 |
self.illegal = illegal |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
272 |
assert(self.notfound or self.illegal) |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
273 |
|
596
f4519e2a99bc
3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
565
diff
changeset
|
274 |
def __str__(self): |
f4519e2a99bc
3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
565
diff
changeset
|
275 |
outstr = "" |
f4519e2a99bc
3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
565
diff
changeset
|
276 |
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
|
277 |
# 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
|
278 |
outstr += "%s\n" % x |
614
4b620a1e8c01
4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
596
diff
changeset
|
279 |
|
4b620a1e8c01
4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
596
diff
changeset
|
280 |
if self.notfound: |
4b620a1e8c01
4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
596
diff
changeset
|
281 |
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
|
282 |
"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
|
283 |
"the current publishers:\n") |
614
4b620a1e8c01
4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
596
diff
changeset
|
284 |
|
4b620a1e8c01
4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
596
diff
changeset
|
285 |
for x in self.notfound: |
4b620a1e8c01
4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
596
diff
changeset
|
286 |
outstr += "%s\n" % x |
4b620a1e8c01
4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
596
diff
changeset
|
287 |
|
596
f4519e2a99bc
3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
565
diff
changeset
|
288 |
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
|
289 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
290 |
|
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
291 |
class SearchException(ApiException): |
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
292 |
"""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
|
293 |
pass |
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
294 |
|
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
295 |
|
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
296 |
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
|
297 |
""" 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
|
298 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
299 |
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
|
300 |
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
|
301 |
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
|
302 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
303 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
304 |
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
|
305 |
"""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
|
306 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
307 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
308 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
309 |
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
|
310 |
""" 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
|
311 |
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
|
312 |
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
|
313 |
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
|
314 |
"%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
|
315 |
"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
|
316 |
"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
|
317 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
318 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
319 |
class MainDictParsingException(SearchException): |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
320 |
"""This is used when the main dictionary could not parse a line.""" |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
321 |
def __init__(self, e): |
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
322 |
SearchException.__init__(self) |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
323 |
self.e = e |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
324 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
325 |
def __str__(self): |
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
326 |
return str(self.e) |
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
327 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
328 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
329 |
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
|
330 |
"""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
|
331 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
332 |
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
|
333 |
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
|
334 |
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
|
335 |
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
|
336 |
""" |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
337 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
338 |
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
|
339 |
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
|
340 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
341 |
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
|
342 |
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
|
343 |
|
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
|
344 |
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
|
345 |
"""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
|
346 |
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
|
347 |
def __init__(self, url, data): |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
348 |
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
|
349 |
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
|
350 |
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
|
351 |
|
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
|
352 |
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
|
353 |
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
|
354 |
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
|
355 |
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
|
356 |
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
|
357 |
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
|
358 |
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
|
359 |
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
|
360 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
361 |
class DataError(ApiException): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
362 |
"""Base exception class used for all data related errors.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
363 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
364 |
def __init__(self, *args, **kwargs): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
365 |
ApiException.__init__(self, *args) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
366 |
if args: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
367 |
self.data = args[0] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
368 |
else: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
369 |
self.data = None |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
370 |
self.args = kwargs |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
371 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
372 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
373 |
class InvalidP5IFile(DataError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
374 |
"""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
|
375 |
valid p5i-formatted file.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
376 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
377 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
378 |
if self.data: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
379 |
return _("The specified file is in an unrecognized " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
380 |
"format or does not contain valid publisher " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
381 |
"information: %s") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
382 |
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
|
383 |
"does not contain valid publisher information.") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
384 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
385 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
386 |
class UnsupportedP5IFile(DataError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
387 |
"""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
|
388 |
of pkg(5) info file was attempted.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
389 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
390 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
391 |
return _("Unsupported pkg(5) publisher information data " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
392 |
"format.") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
393 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
394 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
395 |
class TransportError(ApiException): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
396 |
"""Base exception class for all transfer exceptions.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
397 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
398 |
def __init__(self, *args, **kwargs): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
399 |
ApiException.__init__(self, *args) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
400 |
if args: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
401 |
self.data = args[0] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
402 |
else: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
403 |
self.data = None |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
404 |
self.args = kwargs |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
405 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
406 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
407 |
return str(self.data) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
408 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
409 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
410 |
class RetrievalError(TransportError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
411 |
"""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
|
412 |
retrieved.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
413 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
414 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
415 |
location = self.args.get("location", None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
416 |
if location: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
417 |
return _("Error encountered while retrieving data from " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
418 |
"'%s':\n%s") % (location, self.data) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
419 |
return _("Error encountered while retrieving data from: %s") % \ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
420 |
self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
421 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
422 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
423 |
class InvalidResourceLocation(TransportError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
424 |
"""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
|
425 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
426 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
427 |
return _("'%s' is not a valid location.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
428 |
|
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
429 |
class BEException(ApiException): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
430 |
def __init__(self): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
431 |
ApiException.__init__(self) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
432 |
|
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
|
433 |
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
|
434 |
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
|
435 |
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
|
436 |
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
|
437 |
|
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
|
438 |
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
|
439 |
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
|
440 |
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
|
441 |
|
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
|
442 |
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
|
443 |
"""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
|
444 |
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
|
445 |
|
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
|
446 |
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
|
447 |
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
|
448 |
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
|
449 |
|
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
|
450 |
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
|
451 |
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
|
452 |
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
|
453 |
|
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
|
454 |
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
|
455 |
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
|
456 |
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
|
457 |
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
|
458 |
|
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
|
459 |
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
|
460 |
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
|
461 |
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
|
462 |
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
|
463 |
|
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
|
464 |
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
|
465 |
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
|
466 |
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
|
467 |
|
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
|
468 |
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
|
469 |
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
|
470 |
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
|
471 |
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
|
472 |
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
|
473 |
|
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
|
474 |
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
|
475 |
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
|
476 |
"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
|
477 |
"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
|
478 |
} |
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
|
479 |
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
|
480 |
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
|
481 |
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
|
482 |
|
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
|
483 |
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
|
484 |
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
|
485 |
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
|
486 |
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
|
487 |
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
|
488 |
|
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
|
489 |
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
|
490 |
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
|
491 |
{"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
|
492 |
|
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
|
493 |
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
|
494 |
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
|
495 |
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
|
496 |
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
|
497 |
|
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
|
498 |
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
|
499 |
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
|
500 |
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
|
501 |
not allowed.""") |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
502 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
503 |
|
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
|
504 |
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
|
505 |
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
|
506 |
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
|
507 |
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
|
508 |
|
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
|
509 |
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
|
510 |
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
|
511 |
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
|
512 |
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
|
513 |
return s |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
514 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
515 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
516 |
class ProblematicSearchServers(SearchException): |
1100
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
517 |
"""This class wraps exceptions which could appear while trying to |
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
518 |
do a search request.""" |
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
519 |
|
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
520 |
def __init__(self, failed, invalid): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
521 |
self.failed_servers = failed |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
522 |
self.invalid_servers = invalid |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
523 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
524 |
def __str__(self): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
525 |
s = _("Some servers failed to respond appropriately:\n") |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
526 |
for pub, err in self.failed_servers: |
1051
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
527 |
# The messages and structure for these error |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
528 |
# messages was often lifted from retrieve.py. |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
529 |
if isinstance(err, urllib2.HTTPError): |
1051
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
530 |
s += _(" %(o)s: %(msg)s (%(code)d)\n") % \ |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
531 |
{ "o": pub["origin"], "msg": err.msg, |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
532 |
"code": err.code } |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
533 |
elif isinstance(err, urllib2.URLError): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
534 |
if isinstance(err.args[0], socket.timeout): |
1051
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
535 |
s += _(" %s: timeout\n") % \ |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
536 |
(pub["origin"],) |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
537 |
else: |
1051
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
538 |
s += _(" %(o)s: %(other)s\n") % \ |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
539 |
{ "o": pub["origin"], |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
540 |
"other": err.args[0][1] } |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
541 |
elif isinstance(err, httplib.BadStatusLine): |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
542 |
s += _(" %(o)s: Unable to read status of " |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
543 |
"HTTP response:%(l)s\n This is " |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
544 |
"most likely not a pkg(5) depot. Please " |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
545 |
"check the URL and the \n port " |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
546 |
"number.") % \ |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
547 |
{ "o": pub["origin"], "l": err.line} |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
548 |
elif isinstance(err, |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
549 |
(httplib.IncompleteRead, ValueError)): |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
550 |
s += _(" %s: Incomplete read from " |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
551 |
"host") % pub["origin"] |
1100
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
552 |
# RunetimeErrors arise when no supported version |
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
553 |
# of the operation request is found. |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
554 |
elif isinstance(err, RuntimeError): |
1051
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
555 |
s += _(" %(o)s: %(msg)s\n") % \ |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
556 |
{ "o": pub["origin"], "msg": err} |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
557 |
elif isinstance(err, socket.timeout): |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
558 |
s += _(" %s: Socket timeout") % pub["origin"] |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
559 |
elif isinstance(err, socket.error): |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
560 |
s += _(" %(o)s: Socket error, reason: " |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
561 |
"%(msg)s") % { "o": pub["origin"], |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
562 |
"msg": err } |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
563 |
else: |
1051
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
564 |
s += _(" %(o)s: %(msg)s") % \ |
6b47b42fddcc
7367 search needs to catch more possible exceptions from transport
Brock Pytlik <bpytlik@sun.com>
parents:
1050
diff
changeset
|
565 |
{ "o": pub["origin"], "msg": err} |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
566 |
for pub in self.invalid_servers: |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
567 |
s += _("%s appears not to be a valid package depot.\n" \ |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
568 |
% pub['origin']) |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
569 |
return s |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
570 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
571 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
572 |
class IncorrectIndexFileHash(ApiException): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
573 |
"""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
|
574 |
packages installed in the image.""" |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
575 |
pass |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
576 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
577 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
578 |
class InconsistentIndexException(IndexingException): |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
579 |
"""This is used when the existing index is found to have inconsistent |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
580 |
versions.""" |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
581 |
def __init__(self, e): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
582 |
self.exception = e |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
583 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
584 |
def __str__(self): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
585 |
return str(self.exception) |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
586 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
587 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
588 |
class SlowSearchUsed(SearchException): |
1100
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
589 |
"""This exception is thrown when a local search is performed without |
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
590 |
an index. It's raised after all results have been yielded.""" |
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
591 |
|
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
592 |
def __str__(self): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
593 |
return _("Search capabilities and performance are degraded.\n" |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
594 |
"To improve, run 'pkg rebuild-index'.") |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
595 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
596 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
597 |
class BooleanQueryException(ApiException): |
1100
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
598 |
"""This exception is used when the children of a boolean operation |
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
599 |
have different return types. The command 'pkg search foo AND <bar>' |
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
600 |
is the simplest example of this.""" |
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
601 |
|
1053
00fe9773d072
8098 parsing errors should not cause a stacktrace
Brock Pytlik <bpytlik@sun.com>
parents:
1051
diff
changeset
|
602 |
def __init__(self, e): |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
603 |
ApiException.__init__(self) |
1053
00fe9773d072
8098 parsing errors should not cause a stacktrace
Brock Pytlik <bpytlik@sun.com>
parents:
1051
diff
changeset
|
604 |
self.e = e |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
605 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
606 |
def __str__(self): |
1053
00fe9773d072
8098 parsing errors should not cause a stacktrace
Brock Pytlik <bpytlik@sun.com>
parents:
1051
diff
changeset
|
607 |
return str(self.e) |
00fe9773d072
8098 parsing errors should not cause a stacktrace
Brock Pytlik <bpytlik@sun.com>
parents:
1051
diff
changeset
|
608 |
|
1100
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
609 |
|
1053
00fe9773d072
8098 parsing errors should not cause a stacktrace
Brock Pytlik <bpytlik@sun.com>
parents:
1051
diff
changeset
|
610 |
class ParseError(ApiException): |
00fe9773d072
8098 parsing errors should not cause a stacktrace
Brock Pytlik <bpytlik@sun.com>
parents:
1051
diff
changeset
|
611 |
def __init__(self, e): |
00fe9773d072
8098 parsing errors should not cause a stacktrace
Brock Pytlik <bpytlik@sun.com>
parents:
1051
diff
changeset
|
612 |
ApiException.__init__(self) |
00fe9773d072
8098 parsing errors should not cause a stacktrace
Brock Pytlik <bpytlik@sun.com>
parents:
1051
diff
changeset
|
613 |
self.e = e |
00fe9773d072
8098 parsing errors should not cause a stacktrace
Brock Pytlik <bpytlik@sun.com>
parents:
1051
diff
changeset
|
614 |
|
00fe9773d072
8098 parsing errors should not cause a stacktrace
Brock Pytlik <bpytlik@sun.com>
parents:
1051
diff
changeset
|
615 |
def __str__(self): |
00fe9773d072
8098 parsing errors should not cause a stacktrace
Brock Pytlik <bpytlik@sun.com>
parents:
1051
diff
changeset
|
616 |
return str(self.e) |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
617 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
618 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
619 |
class PublisherError(ApiException): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
620 |
"""Base exception class for all publisher exceptions.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
621 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
622 |
def __init__(self, *args, **kwargs): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
623 |
ApiException.__init__(self, *args) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
624 |
if args: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
625 |
self.data = args[0] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
626 |
else: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
627 |
self.data = None |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
628 |
self.args = kwargs |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
629 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
630 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
631 |
return str(self.data) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
632 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
633 |
|
1087
293c0aa5f32e
8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents:
1076
diff
changeset
|
634 |
class BadPublisherMetaRoot(PublisherError): |
293c0aa5f32e
8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents:
1076
diff
changeset
|
635 |
"""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
|
636 |
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
|
637 |
|
293c0aa5f32e
8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents:
1076
diff
changeset
|
638 |
def __str__(self): |
293c0aa5f32e
8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents:
1076
diff
changeset
|
639 |
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
|
640 |
"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
|
641 |
"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
|
642 |
|
293c0aa5f32e
8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents:
1076
diff
changeset
|
643 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
644 |
class BadPublisherPrefix(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
645 |
"""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
|
646 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
647 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
648 |
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
|
649 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
650 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
651 |
class BadRepositoryAttributeValue(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
652 |
"""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
|
653 |
invalid.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
654 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
655 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
656 |
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
|
657 |
"attribute '%(attribute)s'.") % { |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
658 |
"value": self.args["value"], "attribute": self.data } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
659 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
660 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
661 |
class BadRepositoryCollectionType(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
662 |
"""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
|
663 |
invalid.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
664 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
665 |
def __init__(self, *args, **kwargs): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
666 |
PublisherError.__init__(self, *args, **kwargs) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
667 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
668 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
669 |
return _("'%s' is not a valid repository collection type.") % \ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
670 |
self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
671 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
672 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
673 |
class BadRepositoryURI(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
674 |
"""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
|
675 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
676 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
677 |
return _("'%s' is not a valid URI.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
678 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
679 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
680 |
class BadRepositoryURIPriority(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
681 |
"""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
|
682 |
not valid.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
683 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
684 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
685 |
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
|
686 |
"expected.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
687 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
688 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
689 |
class BadRepositoryURISortPolicy(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
690 |
"""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
|
691 |
invalid.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
692 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
693 |
def __init__(self, *args, **kwargs): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
694 |
PublisherError.__init__(self, *args, **kwargs) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
695 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
696 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
697 |
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
|
698 |
self.data |
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 DisabledPublisher(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
702 |
"""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
|
703 |
during an operation.""" |
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 |
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
|
707 |
"packaging operations.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
708 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
709 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
710 |
class DuplicatePublisher(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
711 |
"""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
|
712 |
exists for an image.""" |
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 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
715 |
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
|
716 |
"already exists.") % self.data |
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 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
719 |
class DuplicateRepository(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
720 |
"""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
|
721 |
already exists for a publisher.""" |
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 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
724 |
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
|
725 |
"already exists for publisher '%s'.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
726 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
727 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
728 |
class DuplicateRepositoryMirror(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
729 |
"""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
|
730 |
repository mirror.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
731 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
732 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
733 |
return _("Mirror '%s' already exists for the specified " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
734 |
"repository.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
735 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
736 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
737 |
class DuplicateRepositoryOrigin(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
738 |
"""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
|
739 |
repository origin.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
740 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
741 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
742 |
return _("Origin '%s' already exists for the specified " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
743 |
"repository.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
744 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
745 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
746 |
class RemovePreferredPublisher(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
747 |
"""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
|
748 |
made.""" |
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 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
751 |
return _("The preferred publisher cannot be removed.") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
752 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
753 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
754 |
class SelectedRepositoryRemoval(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
755 |
"""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
|
756 |
for a publisher was made.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
757 |
|
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 _("Cannot remove the selected repository for a " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
760 |
"publisher.") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
761 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
762 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
763 |
class SetPreferredPublisherDisabled(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
764 |
"""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
|
765 |
preferred publisher was made.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
766 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
767 |
def __str__(self): |
996
31d152a5212b
7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
988
diff
changeset
|
768 |
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
|
769 |
"preferred publisher.") % self.data |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
770 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
771 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
772 |
class UnknownLegalURI(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
773 |
"""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
|
774 |
provided criteria.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
775 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
776 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
777 |
return _("Unknown legal URI '%s'.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
778 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
779 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
780 |
class UnknownPublisher(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
781 |
"""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
|
782 |
provided criteria.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
783 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
784 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
785 |
return _("Unknown publisher '%s'.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
786 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
787 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
788 |
class UnknownRelatedURI(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
789 |
"""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
|
790 |
the provided criteria.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
791 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
792 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
793 |
return _("Unknown related URI '%s'.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
794 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
795 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
796 |
class UnknownRepository(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
797 |
"""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
|
798 |
provided criteria.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
799 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
800 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
801 |
return _("Unknown repository '%s'.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
802 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
803 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
804 |
class UnknownRepositoryMirror(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
805 |
"""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
|
806 |
list of repository mirrors.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
807 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
808 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
809 |
return _("Unknown repository mirror '%s'.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
810 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
811 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
812 |
class UnknownRepositoryOrigin(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
813 |
"""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
|
814 |
list of repository origins.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
815 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
816 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
817 |
return _("Unknown repository origin '%s'") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
818 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
819 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
820 |
class UnsupportedRepositoryURI(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
821 |
"""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
|
822 |
unsupported scheme.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
823 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
824 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
825 |
if self.data: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
826 |
scheme = urlparse.urlsplit(self.data, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
827 |
allow_fragments=0)[0] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
828 |
return _("The URI '%(uri)s' contains an unsupported " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
829 |
"scheme '%(scheme)s'.") % { "uri": self.data, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
830 |
"scheme": scheme } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
831 |
return _("The specified URI contains an unsupported scheme.") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
832 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
833 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
834 |
class UnsupportedRepositoryURIAttribute(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
835 |
"""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
|
836 |
supported for the URI's scheme.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
837 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
838 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
839 |
return _("'%(attr)s' is not supported for '%(scheme)s'.") % { |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
840 |
"attr": self.data, "scheme": self.args["scheme"] } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
841 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
842 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
843 |
class CertificateError(ApiException): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
844 |
"""Base exception class for all certificate exceptions.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
845 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
846 |
def __init__(self, *args, **kwargs): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
847 |
ApiException.__init__(self, *args) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
848 |
if args: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
849 |
self.data = args[0] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
850 |
else: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
851 |
self.data = None |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
852 |
self.args = kwargs |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
853 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
854 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
855 |
return str(self.data) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
856 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
857 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
858 |
class ExpiredCertificate(CertificateError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
859 |
"""Used to indicate that a certificate has expired.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
860 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
861 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
862 |
publisher = self.args.get("publisher", None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
863 |
uri = self.args.get("uri", None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
864 |
if publisher: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
865 |
if uri: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
866 |
return _("Certificate '%(cert)s' for publisher " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
867 |
"'%(pub)s' needed to access '%(uri)s', " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
868 |
"has expired. Please install a valid " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
869 |
"certificate.") % { "cert": self.data, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
870 |
"uri": uri } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
871 |
return _("Certificate '%(cert)s' for publisher " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
872 |
"'%(pub)s', has expired. Please install a valid " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
873 |
"certificate.") % { "cert": self.data, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
874 |
"pub": publisher } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
875 |
if uri: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
876 |
return _("Certificate '%(cert)s', needed to access " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
877 |
"'%(uri)s', has expired. Please install a valid " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
878 |
"certificate.") % { "cert": self.data, "uri": uri } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
879 |
return _("Certificate '%s' has expired. Please install a " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
880 |
"valid certificate.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
881 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
882 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
883 |
class ExpiringCertificate(CertificateError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
884 |
"""Used to indicate that a certificate has expired.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
885 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
886 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
887 |
publisher = self.args.get("publisher", None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
888 |
uri = self.args.get("uri", None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
889 |
days = self.args.get("days", 0) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
890 |
if publisher: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
891 |
if uri: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
892 |
return _("Certificate '%(cert)s' for publisher " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
893 |
"'%(pub)s', needed to access '%(uri)s', " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
894 |
"will expire in '%(days)s' days.") % { |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
895 |
"cert": self.data, "pub": publisher, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
896 |
"uri": uri, "days": days } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
897 |
return _("Certificate '%(cert)s' for publisher " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
898 |
"'%(pub)s' will expire in '%(days)s' days.") % { |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
899 |
"cert": self.data, "pub": publisher, "days": days } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
900 |
if uri: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
901 |
return _("Certificate '%(cert)s', needed to access " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
902 |
"'%(uri)s', will expire in '%(days)s' days.") % { |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
903 |
"cert": self.data, "uri": uri, "days": days } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
904 |
return _("Certificate '%(cert)s' will expire in " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
905 |
"'%(days)s' days.") % { "cert": self.data, "days": days } |
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 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
908 |
class InvalidCertificate(CertificateError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
909 |
"""Used to indicate that a certificate is invalid.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
910 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
911 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
912 |
publisher = self.args.get("publisher", None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
913 |
uri = self.args.get("uri", None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
914 |
if publisher: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
915 |
if uri: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
916 |
return _("Certificate '%(cert)s' for publisher " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
917 |
"'%(pub)s', needed to access '%(uri)s', is " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
918 |
"invalid.") % { "cert": self.data, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
919 |
"pub": publisher, "uri": uri } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
920 |
return _("Certificate '%(cert)s' for publisher " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
921 |
"'%(pub)s' is invalid.") % { "cert": self.data, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
922 |
"pub": publisher } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
923 |
if uri: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
924 |
return _("Certificate '%(cert)s' needed to access " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
925 |
"'%(uri)s' is invalid.") % { "cert": self.data, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
926 |
"uri": uri } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
927 |
return _("Invalid certificate '%s'.") % self.data |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
928 |
|
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 |
class NoSuchCertificate(CertificateError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
931 |
"""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
|
932 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
933 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
934 |
publisher = self.args.get("publisher", None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
935 |
uri = self.args.get("uri", None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
936 |
if publisher: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
937 |
if uri: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
938 |
return _("Unable to locate certificate " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
939 |
"'%(cert)s' for publisher '%(pub)s' needed " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
940 |
"to access '%(uri)s'.") % { |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
941 |
"cert": self.data, "pub": publisher, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
942 |
"uri": uri } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
943 |
return _("Unable to locate certificate '%(cert)s' for " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
944 |
"publisher '%(pub)s'.") % { "cert": self.data, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
945 |
"pub": publisher } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
946 |
if uri: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
947 |
return _("Unable to locate certificate '%(cert)s' " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
948 |
"needed to access '%(uri)s'.") % { |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
949 |
"cert": self.data, "uri": uri } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
950 |
return _("Unable to locate certificate '%s'.") % 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 NotYetValidCertificate(CertificateError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
954 |
"""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
|
955 |
effective date).""" |
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 |
publisher = self.args.get("publisher", None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
959 |
uri = self.args.get("uri", None) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
960 |
if publisher: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
961 |
if uri: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
962 |
return _("Certificate '%(cert)s' for publisher " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
963 |
"'%(pub)s', needed to access '%(uri)s', " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
964 |
"has a future effective date.") % { |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
965 |
"cert": self.data, "pub": publisher, |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
966 |
"uri": uri } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
967 |
return _("Certificate '%(cert)s' for publisher " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
968 |
"'%(pub)s' has a future effective date.") % { |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
969 |
"cert": self.data, "pub": publisher } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
970 |
if uri: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
971 |
return _("Certificate '%(cert)s' needed to access " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
972 |
"'%(uri)s' has a future effective date.") % { |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
973 |
"cert": self.data, "uri": uri } |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
974 |
return _("Certificate '%s' has a future effective date.") % \ |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
975 |
self.data |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
976 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
977 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
978 |
class ServerReturnError(ApiException): |
1100
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
979 |
"""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
|
980 |
client cannot parse correctly.""" |
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
981 |
|
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
982 |
def __init__(self, line): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
983 |
ApiException.__init__(self) |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
984 |
self.line = line |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
985 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
986 |
def __str__(self): |
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
987 |
return _("Gave a bad response:%s") % self.line |