author | Yiteng Zhang <yiteng.zhang@oracle.com> |
Wed, 09 Mar 2016 11:27:23 -0800 | |
changeset 3321 | 52e8eec3014c |
parent 3293 | a3347e4614da |
child 3333 | f35db3d08c09 |
permissions | -rw-r--r-- |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
1 |
#!/usr/bin/python |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
2 |
# |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
4 |
# |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
8 |
# |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
13 |
# |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
19 |
# |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
21 |
# |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
22 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
23 |
# |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
24 |
# Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
25 |
# |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
26 |
|
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
27 |
import errno |
3094
15de2efea709
15618618 solver plan errors could explain incorporation-related failures better
Shawn Walker <shawn.walker@oracle.com>
parents:
3065
diff
changeset
|
28 |
import operator |
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 |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3206
diff
changeset
|
30 |
import six |
2524
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
31 |
import xml.parsers.expat as expat |
3245
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
32 |
from functools import total_ordering |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3206
diff
changeset
|
33 |
from six.moves.urllib.parse import urlsplit |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
34 |
|
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
35 |
# pkg classes |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
36 |
import pkg.client.pkgdefs as pkgdefs |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
37 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
38 |
# 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
|
39 |
# dependency. |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
40 |
EmptyI = tuple() |
838
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
41 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
42 |
class ApiException(Exception): |
2034
d5ee7746faeb
16108 boot environments should be created by default only when needed
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2028
diff
changeset
|
43 |
def __init__(self, *args): |
d5ee7746faeb
16108 boot environments should be created by default only when needed
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2028
diff
changeset
|
44 |
Exception.__init__(self) |
d5ee7746faeb
16108 boot environments should be created by default only when needed
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2028
diff
changeset
|
45 |
self.__verbose_info = [] |
1540
de040c9fd0c0
13003 exception messages not always displayed correctly with python 2.6
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
46 |
|
2034
d5ee7746faeb
16108 boot environments should be created by default only when needed
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2028
diff
changeset
|
47 |
def add_verbose_info(self, info): |
d5ee7746faeb
16108 boot environments should be created by default only when needed
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2028
diff
changeset
|
48 |
self.__verbose_info.extend(info) |
2200
155eda704b2f
16279 Need a way to revert certain editable files to a as-installed state
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2197
diff
changeset
|
49 |
|
2034
d5ee7746faeb
16108 boot environments should be created by default only when needed
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2028
diff
changeset
|
50 |
@property |
d5ee7746faeb
16108 boot environments should be created by default only when needed
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2028
diff
changeset
|
51 |
def verbose_info(self): |
d5ee7746faeb
16108 boot environments should be created by default only when needed
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2028
diff
changeset
|
52 |
return self.__verbose_info |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
53 |
|
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
54 |
class SuidUnsupportedError(ApiException): |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
55 |
def __str__(self): |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
56 |
return _(""" |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
57 |
The pkg client api module can not be invoked from an setuid executable.""") |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
58 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
59 |
|
2524
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
60 |
class HistoryException(ApiException): |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
61 |
"""Private base exception class for all History exceptions.""" |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
62 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
63 |
def __init__(self, *args): |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
64 |
Exception.__init__(self, *args) |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
65 |
self.error = args[0] |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
66 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
67 |
def __str__(self): |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
68 |
return str(self.error) |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
69 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
70 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
71 |
class HistoryLoadException(HistoryException): |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
72 |
"""Used to indicate that an unexpected error occurred while loading |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
73 |
History operation information. |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
74 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
75 |
The first argument should be an exception object related to the |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
76 |
error encountered. |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
77 |
""" |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
78 |
def __init__(self, *args): |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
79 |
HistoryException.__init__(self, *args) |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
80 |
self.parse_failure = isinstance(self.error, expat.ExpatError) |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
81 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
82 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
83 |
class HistoryRequestException(HistoryException): |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
84 |
"""Used to indicate that invalid time / range values were provided to |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
85 |
history API functions.""" |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
86 |
pass |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
87 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
88 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
89 |
class HistoryStoreException(HistoryException): |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
90 |
"""Used to indicate that an unexpected error occurred while storing |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
91 |
History operation information. |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
92 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
93 |
The first argument should be an exception object related to the |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
94 |
error encountered. |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
95 |
""" |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
96 |
pass |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
97 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
98 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
99 |
class HistoryPurgeException(HistoryException): |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
100 |
"""Used to indicate that an unexpected error occurred while purging |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
101 |
History operation information. |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
102 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
103 |
The first argument should be an exception object related to the |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
104 |
error encountered. |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
105 |
""" |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
106 |
pass |
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
107 |
|
0c32a79b1684
17252 pkg.client.api should provide history management interface
Shawn Walker <shawn.walker@oracle.com>
parents:
2510
diff
changeset
|
108 |
|
1710
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
109 |
class ImageLockedError(ApiException): |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
110 |
"""Used to indicate that the image is currently locked by another thread |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
111 |
or process and cannot be modified.""" |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
112 |
|
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
113 |
def __init__(self, hostname=None, pid=None, pid_name=None): |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
114 |
ApiException.__init__(self) |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
115 |
self.hostname = hostname |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
116 |
self.pid = pid |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
117 |
self.pid_name = pid_name |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
118 |
|
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
119 |
def __str__(self): |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
120 |
if self.pid is not None and self.pid_name is not None and \ |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
121 |
self.hostname is not None: |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
122 |
return _("The image cannot be modified as it is " |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
123 |
"currently in use by another package client: " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
124 |
"{pid_name} on {host}, pid {pid}.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
125 |
pid_name=self.pid_name, pid=self.pid, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
126 |
host=self.hostname) |
1710
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
127 |
if self.pid is not None and self.pid_name is not None: |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
128 |
return _("The image cannot be modified as it is " |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
129 |
"currently in use by another package client: " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
130 |
"{pid_name} on an unknown host, pid {pid}.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
131 |
pid_name=self.pid_name, pid=self.pid) |
1710
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
132 |
elif self.pid is not None: |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
133 |
return _("The image cannot be modified as it is " |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
134 |
"currently in use by another package client: " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
135 |
"pid {pid} on {host}.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
136 |
pid=self.pid, host=self.hostname) |
1710
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
137 |
return _("The image cannot be modified as it is currently " |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
138 |
"in use by another package client.") |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
139 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
140 |
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
|
141 |
"""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
|
142 |
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
|
143 |
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
|
144 |
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
|
145 |
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
|
146 |
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
|
147 |
|
2976
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
148 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
149 |
return _("No image rooted at '{0}'").format(self.user_dir) |
2976
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
150 |
|
2144
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
151 |
|
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
152 |
class ImageFormatUpdateNeeded(ApiException): |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
153 |
"""Used to indicate that an image cannot be used until its format is |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
154 |
updated.""" |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
155 |
|
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
156 |
def __init__(self, path): |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
157 |
ApiException.__init__(self) |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
158 |
self.path = path |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
159 |
|
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
160 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
161 |
return _("The image rooted at {0} is written in an older format " |
2144
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
162 |
"and must be updated before the requested operation can be " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
163 |
"performed.").format(self.path) |
2144
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
164 |
|
2407
a831f1491c86
1769 pkg(5) doesn't check for disk space
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2400
diff
changeset
|
165 |
class ImageInsufficentSpace(ApiException): |
a831f1491c86
1769 pkg(5) doesn't check for disk space
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2400
diff
changeset
|
166 |
"""Used when insuffcient space exists for proposed operation""" |
a831f1491c86
1769 pkg(5) doesn't check for disk space
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2400
diff
changeset
|
167 |
def __init__(self, needed, avail, use): |
a831f1491c86
1769 pkg(5) doesn't check for disk space
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2400
diff
changeset
|
168 |
self.needed = needed |
a831f1491c86
1769 pkg(5) doesn't check for disk space
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2400
diff
changeset
|
169 |
self.avail = avail |
a831f1491c86
1769 pkg(5) doesn't check for disk space
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2400
diff
changeset
|
170 |
self.use = use |
a831f1491c86
1769 pkg(5) doesn't check for disk space
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2400
diff
changeset
|
171 |
|
a831f1491c86
1769 pkg(5) doesn't check for disk space
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2400
diff
changeset
|
172 |
def __str__(self): |
a831f1491c86
1769 pkg(5) doesn't check for disk space
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2400
diff
changeset
|
173 |
from pkg.misc import bytes_to_str |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
174 |
return _("Insufficient disk space available ({avail}) " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
175 |
"for estimated need ({needed}) for {use}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
176 |
avail=bytes_to_str(self.avail), |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
177 |
needed=bytes_to_str(self.needed), |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
178 |
use=self.use |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
179 |
) |
2875
09e276ba70c6
15804991 option mangling and verification should be part of the API, not the CLI client
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2847
diff
changeset
|
180 |
|
2144
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
181 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
182 |
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
|
183 |
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
|
184 |
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
|
185 |
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
|
186 |
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
|
187 |
|
2144
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
188 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
189 |
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
|
190 |
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
|
191 |
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
|
192 |
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
|
193 |
|
1618
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
194 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
195 |
class PlanPrepareException(ApiException): |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
196 |
"""Base exception class for plan preparation errors.""" |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
197 |
pass |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
198 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
199 |
|
1755
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
200 |
class InvalidPackageErrors(ApiException): |
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
201 |
"""Used to indicate that the requested operation could not be completed |
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
202 |
as one or more packages contained invalid metadata.""" |
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
203 |
|
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
204 |
def __init__(self, errors): |
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
205 |
"""'errors' should be a list of exceptions or strings |
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
206 |
indicating what packages had errors and why.""" |
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
207 |
|
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
208 |
ApiException.__init__(self) |
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
209 |
self.errors = errors |
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
210 |
|
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
211 |
def __str__(self): |
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
212 |
return _("The requested operation cannot be completed due " |
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
213 |
"to invalid package metadata. Details follow:\n\n" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
214 |
"{0}").format("\n".join(str(e) for e in self.errors)) |
1755
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
215 |
|
8e1ed1373f93
9123 client traceback during install for bad file mode
Shawn Walker <srw@sun.com>
parents:
1736
diff
changeset
|
216 |
|
1618
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
217 |
class LicenseAcceptanceError(ApiException): |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
218 |
"""Used to indicate that license-related errors occurred during |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
219 |
plan evaluation or execution.""" |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
220 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
221 |
def __init__(self, pfmri, src=None, dest=None, accepted=None, |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
222 |
displayed=None): |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
223 |
ApiException.__init__(self) |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
224 |
self.fmri = pfmri |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
225 |
self.src = src |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
226 |
self.dest = dest |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
227 |
self.accepted = accepted |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
228 |
self.displayed = displayed |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
229 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
230 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
231 |
class PkgLicenseErrors(PlanPrepareException): |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
232 |
"""Used to indicate that plan evaluation or execution failed due |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
233 |
to license-related errors for a package.""" |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
234 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
235 |
def __init__(self, errors): |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
236 |
"""'errors' should be a list of LicenseAcceptanceError |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
237 |
exceptions.""" |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
238 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
239 |
PlanPrepareException.__init__(self) |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
240 |
self.__errors = errors |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
241 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
242 |
@property |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
243 |
def errors(self): |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
244 |
"""A list of LicenseAcceptanceError exceptions.""" |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
245 |
return self.__errors |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
246 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
247 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
248 |
class PlanLicenseErrors(PlanPrepareException): |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
249 |
"""Used to indicate that image plan evaluation or execution failed due |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
250 |
to license-related errors.""" |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
251 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
252 |
def __init__(self, pp_errors): |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
253 |
"""'errors' should be a list of PkgLicenseErrors exceptions.""" |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
254 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
255 |
PlanPrepareException.__init__(self) |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
256 |
self.__errors = pkgs = {} |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
257 |
for pp_err in pp_errors: |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
258 |
for e in pp_err.errors: |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
259 |
pkgs.setdefault(str(e.fmri), []).append(e) |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
260 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
261 |
@property |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
262 |
def errors(self): |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
263 |
"""Returns a dictionary indexed by package FMRI string of |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
264 |
lists of LicenseAcceptanceError exceptions.""" |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
265 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
266 |
return self.__errors |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
267 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
268 |
def __str__(self): |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
269 |
"""Returns a string representation of the license errors.""" |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
270 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
271 |
output = "" |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
272 |
for sfmri in self.__errors: |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
273 |
output += ("-" * 40) + "\n" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
274 |
output += _("Package: {0}\n\n").format(sfmri) |
1618
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
275 |
for e in self.__errors[sfmri]: |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
276 |
lic_name = e.dest.attrs["license"] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
277 |
output += _("License: {0}\n").format(lic_name) |
1618
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
278 |
if e.dest.must_accept and not e.accepted: |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
279 |
output += _(" License requires " |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
280 |
"acceptance.") |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
281 |
if e.dest.must_display and not e.displayed: |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
282 |
output += _(" License must be viewed.") |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
283 |
output += "\n" |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
284 |
return output |
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
285 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
286 |
|
1019
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
287 |
class ActuatorException(ApiException): |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
288 |
def __init__(self, e): |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
289 |
ApiException.__init__(self) |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
290 |
self.exception = e |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
291 |
|
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
292 |
def __str__(self): |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
293 |
return str(self.exception) |
e61c57c724c9
7663 disable_fmri should be synchronous
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
996
diff
changeset
|
294 |
|
1618
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
295 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
296 |
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
|
297 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
298 |
|
1618
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
299 |
|
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
300 |
class AlreadyPreparedException(PlanPrepareException): |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
301 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
302 |
|
1618
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
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 AlreadyExecutedException(ApiException): |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
305 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
306 |
|
1618
04f7471c9e72
5943 add 'must-accept' attribute to license actions
Shawn Walker <srw@sun.com>
parents:
1603
diff
changeset
|
307 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
308 |
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
|
309 |
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
|
310 |
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
|
311 |
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
|
312 |
|
1369
e86145680c34
11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents:
1352
diff
changeset
|
313 |
|
1710
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
314 |
class InvalidPlanError(ApiException): |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
315 |
"""Used to indicate that the image plan is no longer valid, likely as a |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
316 |
result of an image state change since the plan was created.""" |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
317 |
|
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
318 |
def __str__(self): |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
319 |
return _("The plan for the current operation is no longer " |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
320 |
"valid. The image has likely been modified by another " |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
321 |
"process or client. Please try the operation again.") |
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
322 |
|
139720e2e756
1668 image locking needed to prevent race conditions
Shawn Walker <srw@sun.com>
parents:
1618
diff
changeset
|
323 |
|
1372
484408dfa0a1
11483 ImagePkgStateError needs correction
Shawn Walker <srw@sun.com>
parents:
1370
diff
changeset
|
324 |
class ImagePkgStateError(ApiException): |
1369
e86145680c34
11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents:
1352
diff
changeset
|
325 |
|
e86145680c34
11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents:
1352
diff
changeset
|
326 |
def __init__(self, fmri, states): |
e86145680c34
11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents:
1352
diff
changeset
|
327 |
ApiException.__init__(self) |
e86145680c34
11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents:
1352
diff
changeset
|
328 |
self.fmri = fmri |
e86145680c34
11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents:
1352
diff
changeset
|
329 |
self.states = states |
e86145680c34
11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents:
1352
diff
changeset
|
330 |
|
e86145680c34
11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents:
1352
diff
changeset
|
331 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
332 |
return _("Invalid package state change attempted '{states}' " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
333 |
"for package '{fmri}'.").format(states=self.states, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
334 |
fmri=self.fmri) |
1369
e86145680c34
11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents:
1352
diff
changeset
|
335 |
|
e86145680c34
11359 catalog should offer lazy-load mechanism for action metadata
Shawn Walker <srw@sun.com>
parents:
1352
diff
changeset
|
336 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
337 |
class IpkgOutOfDateException(ApiException): |
2976
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
338 |
def __str__(self): |
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
339 |
return _("pkg(5) out of date") |
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
340 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
341 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
342 |
class ImageUpdateOnLiveImageException(ApiException): |
2976
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
343 |
def __str__(self): |
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
344 |
return _("Requested operation cannot be performed " |
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
345 |
"in live image.") |
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
346 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
347 |
|
1328
5c3747a4fe0a
9387 pkg fix should honor reboot-needed flag
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1286
diff
changeset
|
348 |
class RebootNeededOnLiveImageException(ApiException): |
2976
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
349 |
def __str__(self): |
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
350 |
return _("Requested operation cannot be performed " |
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
351 |
"in live image.") |
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
352 |
|
1328
5c3747a4fe0a
9387 pkg fix should honor reboot-needed flag
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1286
diff
changeset
|
353 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
354 |
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
|
355 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
356 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
357 |
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
|
358 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
359 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
360 |
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
|
361 |
pass |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
362 |
|
685
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
363 |
class PermissionsException(ApiException): |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
364 |
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
|
365 |
ApiException.__init__(self) |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
366 |
self.path = path |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
367 |
|
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
368 |
def __str__(self): |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
369 |
if self.path: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
370 |
return _("Could not operate on {0}\nbecause of " |
2126
7f6719cd083b
14316 please suggest the proper classification and product in the pkg error message
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
371 |
"insufficient permissions. Please try the " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
372 |
"command again as a privileged user.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
373 |
self.path) |
685
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
374 |
else: |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
375 |
return _(""" |
2126
7f6719cd083b
14316 please suggest the proper classification and product in the pkg error message
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
376 |
Could not complete the operation because of insufficient permissions. |
7f6719cd083b
14316 please suggest the proper classification and product in the pkg error message
Shawn Walker <shawn.walker@oracle.com>
parents:
2100
diff
changeset
|
377 |
Please try the command again as a privileged user. |
685
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
378 |
""") |
6f53483db920
1469 image-update by unprivileged user should give better error message
Brock Pytlik <bpytlik@sun.com>
parents:
655
diff
changeset
|
379 |
|
879
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
380 |
class FileInUseException(PermissionsException): |
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
381 |
def __init__(self, path): |
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
382 |
PermissionsException.__init__(self, path) |
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
383 |
assert path |
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
384 |
|
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
385 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
386 |
return _("Could not operate on {0}\nbecause the file is " |
879
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
387 |
"in use. Please stop using the file and try the\n" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
388 |
"operation again.").format(self.path) |
879
3e4622a4c074
2747 make per-package progress output work on Windows
Tom Mueller <Tom.Mueller@sun.com>
parents:
838
diff
changeset
|
389 |
|
1335
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
390 |
|
2612
7bf2387ebd19
18958 Error message concerning /var/pkg/lock & lack of privileges could be improved
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2524
diff
changeset
|
391 |
class UnprivilegedUserError(PermissionsException): |
7bf2387ebd19
18958 Error message concerning /var/pkg/lock & lack of privileges could be improved
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2524
diff
changeset
|
392 |
def __init__(self, path): |
7bf2387ebd19
18958 Error message concerning /var/pkg/lock & lack of privileges could be improved
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2524
diff
changeset
|
393 |
PermissionsException.__init__(self, path) |
7bf2387ebd19
18958 Error message concerning /var/pkg/lock & lack of privileges could be improved
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2524
diff
changeset
|
394 |
|
7bf2387ebd19
18958 Error message concerning /var/pkg/lock & lack of privileges could be improved
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2524
diff
changeset
|
395 |
def __str__(self): |
7bf2387ebd19
18958 Error message concerning /var/pkg/lock & lack of privileges could be improved
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2524
diff
changeset
|
396 |
return _("Insufficient access to complete the requested " |
7bf2387ebd19
18958 Error message concerning /var/pkg/lock & lack of privileges could be improved
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2524
diff
changeset
|
397 |
"operation.\nPlease try the operation again as a " |
7bf2387ebd19
18958 Error message concerning /var/pkg/lock & lack of privileges could be improved
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2524
diff
changeset
|
398 |
"privileged user.") |
7bf2387ebd19
18958 Error message concerning /var/pkg/lock & lack of privileges could be improved
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2524
diff
changeset
|
399 |
|
7bf2387ebd19
18958 Error message concerning /var/pkg/lock & lack of privileges could be improved
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2524
diff
changeset
|
400 |
|
1335
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
401 |
class ReadOnlyFileSystemException(PermissionsException): |
1945
a4fc142accb2
16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents:
1937
diff
changeset
|
402 |
"""Used to indicate that the operation was attempted on a |
1335
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
403 |
read-only filesystem""" |
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
404 |
|
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
405 |
def __init__(self, path): |
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
406 |
ApiException.__init__(self) |
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
407 |
self.path = path |
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
408 |
|
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
409 |
def __str__(self): |
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
410 |
if self.path: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
411 |
return _("Could not complete the operation on {0}: " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
412 |
"read-only filesystem.").format(self.path) |
1335
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
413 |
return _("Could not complete the operation: read-only " |
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
414 |
"filesystem.") |
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
415 |
|
3dde2385d05c
516 Clean up traceback for installs to read-only filesystems
John Sonnenschein <John.Sonnenschein@Sun.COM>
parents:
1328
diff
changeset
|
416 |
|
2974
753adc11f1a6
17376567 Unable to use pkgrecv - failing with [Errno 22] Invalid argument
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
2962
diff
changeset
|
417 |
class InvalidLockException(ApiException): |
753adc11f1a6
17376567 Unable to use pkgrecv - failing with [Errno 22] Invalid argument
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
2962
diff
changeset
|
418 |
def __init__(self, path): |
753adc11f1a6
17376567 Unable to use pkgrecv - failing with [Errno 22] Invalid argument
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
2962
diff
changeset
|
419 |
ApiException.__init__(self) |
753adc11f1a6
17376567 Unable to use pkgrecv - failing with [Errno 22] Invalid argument
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
2962
diff
changeset
|
420 |
self.path = path |
753adc11f1a6
17376567 Unable to use pkgrecv - failing with [Errno 22] Invalid argument
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
2962
diff
changeset
|
421 |
|
753adc11f1a6
17376567 Unable to use pkgrecv - failing with [Errno 22] Invalid argument
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
2962
diff
changeset
|
422 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
423 |
return _("Unable to obtain or operate on lock at {0}.\n" |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
424 |
"Please try the operation again as a privileged " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
425 |
"user.").format(self.path) |
2974
753adc11f1a6
17376567 Unable to use pkgrecv - failing with [Errno 22] Invalid argument
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
2962
diff
changeset
|
426 |
|
753adc11f1a6
17376567 Unable to use pkgrecv - failing with [Errno 22] Invalid argument
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
2962
diff
changeset
|
427 |
|
2301
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
428 |
class PackageMatchErrors(ApiException): |
2510
f48530fd135d
18440 pkgrepo should be able to list packages
Shawn Walker <shawn.walker@oracle.com>
parents:
2505
diff
changeset
|
429 |
"""Used to indicate which patterns were not matched or illegal during |
f48530fd135d
18440 pkgrepo should be able to list packages
Shawn Walker <shawn.walker@oracle.com>
parents:
2505
diff
changeset
|
430 |
a package name matching operation.""" |
f48530fd135d
18440 pkgrepo should be able to list packages
Shawn Walker <shawn.walker@oracle.com>
parents:
2505
diff
changeset
|
431 |
|
2301
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
432 |
def __init__(self, unmatched_fmris=EmptyI, multiple_matches=EmptyI, |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
433 |
illegal=EmptyI, multispec=EmptyI): |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
434 |
ApiException.__init__(self) |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
435 |
self.unmatched_fmris = unmatched_fmris |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
436 |
self.multiple_matches = multiple_matches |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
437 |
self.illegal = illegal |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
438 |
self.multispec = multispec |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
439 |
|
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
440 |
def __str__(self): |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
441 |
res = [] |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
442 |
if self.unmatched_fmris: |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
443 |
s = _("The following pattern(s) did not match any " |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
444 |
"packages:") |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
445 |
|
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
446 |
res += [s] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
447 |
res += ["\t{0}".format(p) for p in self.unmatched_fmris] |
2301
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
448 |
|
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
449 |
if self.multiple_matches: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
450 |
s = _("'{0}' matches multiple packages") |
2301
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
451 |
for p, lst in self.multiple_matches: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
452 |
res.append(s.format(p)) |
2301
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
453 |
for pfmri in lst: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
454 |
res.append("\t{0}".format(pfmri)) |
2301
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
455 |
|
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
456 |
if self.illegal: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
457 |
s = _("'{0}' is an illegal FMRI") |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
458 |
res += [ s.format(p) for p in self.illegal ] |
2301
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
459 |
|
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
460 |
if self.multispec: |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
461 |
s = _("The following different patterns specify the " |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
462 |
"same package(s):") |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
463 |
res += [s] |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
464 |
for t in self.multispec: |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
465 |
res += [ |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
466 |
", ".join([t[i] for i in range(1, len(t))]) |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
467 |
+ ": {0}".format(t[0]) |
2301
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
468 |
] |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
469 |
|
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
470 |
return "\n".join(res) |
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
471 |
|
d4b6490d2c24
7213 pkgrepo should support package removal
Shawn Walker <shawn.walker@oracle.com>
parents:
2286
diff
changeset
|
472 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
473 |
class PlanCreationException(ApiException): |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
474 |
def __init__(self, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
475 |
already_installed=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
476 |
badarch=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
477 |
illegal=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
478 |
installed=EmptyI, |
2453
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
479 |
invalid_mediations=EmptyI, |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
480 |
linked_pub_error=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
481 |
missing_dependency=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
482 |
missing_matches=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
483 |
multiple_matches=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
484 |
multispec=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
485 |
no_solution=False, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
486 |
no_tmp_origins=False, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
487 |
no_version=EmptyI, |
2505
c16c3063cdf7
18560 pkg unavoid is unavoidably broken
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2500
diff
changeset
|
488 |
not_avoided=EmptyI, |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
489 |
nofiles=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
490 |
obsolete=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
491 |
pkg_updates_required=EmptyI, |
2445
3ae7fde31e19
18512 install/update matching could account for reject matches
Shawn Walker <shawn.walker@oracle.com>
parents:
2444
diff
changeset
|
492 |
rejected_pats=EmptyI, |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
493 |
solver_errors=EmptyI, |
3110
5590234ea9b2
19190899 pkg needs subcommands to dehydrate/rehydrate image
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3107
diff
changeset
|
494 |
no_repo_pubs=EmptyI, |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
495 |
unmatched_fmris=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
496 |
would_install=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
497 |
wrong_publishers=EmptyI, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
498 |
wrong_variants=EmptyI): |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
499 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
500 |
ApiException.__init__(self) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
501 |
self.already_installed = already_installed |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
502 |
self.badarch = badarch |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
503 |
self.illegal = illegal |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
504 |
self.installed = installed |
2453
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
505 |
self.invalid_mediations = invalid_mediations |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
506 |
self.linked_pub_error = linked_pub_error |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
507 |
self.missing_dependency = missing_dependency |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
508 |
self.missing_matches = missing_matches |
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
509 |
self.multiple_matches = multiple_matches |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
510 |
self.multispec = multispec |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
511 |
self.no_solution = no_solution |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
512 |
self.no_tmp_origins = no_tmp_origins |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
513 |
self.no_version = no_version |
2505
c16c3063cdf7
18560 pkg unavoid is unavoidably broken
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2500
diff
changeset
|
514 |
self.not_avoided = not_avoided |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
515 |
self.nofiles = nofiles |
2207
029ca014fced
17797 plan debugging should also display solver trim database
Shawn Walker <shawn.walker@oracle.com>
parents:
2205
diff
changeset
|
516 |
self.obsolete = obsolete |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
517 |
self.pkg_updates_required = pkg_updates_required |
2445
3ae7fde31e19
18512 install/update matching could account for reject matches
Shawn Walker <shawn.walker@oracle.com>
parents:
2444
diff
changeset
|
518 |
self.rejected_pats = rejected_pats |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
519 |
self.solver_errors = solver_errors |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
520 |
self.unmatched_fmris = unmatched_fmris |
3110
5590234ea9b2
19190899 pkg needs subcommands to dehydrate/rehydrate image
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3107
diff
changeset
|
521 |
self.no_repo_pubs = no_repo_pubs |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
522 |
self.would_install = would_install |
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
523 |
self.wrong_publishers = wrong_publishers |
2212
9936333985a6
738 "install world" for pkg
Shawn Walker <shawn.walker@oracle.com>
parents:
2207
diff
changeset
|
524 |
self.wrong_variants = wrong_variants |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
525 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
526 |
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
|
527 |
res = [] |
1141
a74d6815a7fc
4178 unfound_fmris is a poor name
Rich Burridge <rich.burridge@sun.com>
parents:
1130
diff
changeset
|
528 |
if self.unmatched_fmris: |
616
6d307b088d92
4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents:
614
diff
changeset
|
529 |
s = _("""\ |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
530 |
The following pattern(s) did not match any allowable packages. Try |
2445
3ae7fde31e19
18512 install/update matching could account for reject matches
Shawn Walker <shawn.walker@oracle.com>
parents:
2444
diff
changeset
|
531 |
using a different matching pattern, or refreshing publisher information: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
532 |
""") |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
533 |
res += [s] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
534 |
res += ["\t{0}".format(p) for p in self.unmatched_fmris] |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
535 |
|
2445
3ae7fde31e19
18512 install/update matching could account for reject matches
Shawn Walker <shawn.walker@oracle.com>
parents:
2444
diff
changeset
|
536 |
if self.rejected_pats: |
3ae7fde31e19
18512 install/update matching could account for reject matches
Shawn Walker <shawn.walker@oracle.com>
parents:
2444
diff
changeset
|
537 |
s = _("""\ |
3ae7fde31e19
18512 install/update matching could account for reject matches
Shawn Walker <shawn.walker@oracle.com>
parents:
2444
diff
changeset
|
538 |
The following pattern(s) only matched packages rejected by user request. Try |
3ae7fde31e19
18512 install/update matching could account for reject matches
Shawn Walker <shawn.walker@oracle.com>
parents:
2444
diff
changeset
|
539 |
using a different matching pattern, or refreshing publisher information: |
3ae7fde31e19
18512 install/update matching could account for reject matches
Shawn Walker <shawn.walker@oracle.com>
parents:
2444
diff
changeset
|
540 |
""") |
3ae7fde31e19
18512 install/update matching could account for reject matches
Shawn Walker <shawn.walker@oracle.com>
parents:
2444
diff
changeset
|
541 |
res += [s] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
542 |
res += ["\t{0}".format(p) for p in self.rejected_pats] |
2445
3ae7fde31e19
18512 install/update matching could account for reject matches
Shawn Walker <shawn.walker@oracle.com>
parents:
2444
diff
changeset
|
543 |
|
2212
9936333985a6
738 "install world" for pkg
Shawn Walker <shawn.walker@oracle.com>
parents:
2207
diff
changeset
|
544 |
if self.wrong_variants: |
9936333985a6
738 "install world" for pkg
Shawn Walker <shawn.walker@oracle.com>
parents:
2207
diff
changeset
|
545 |
s = _("""\ |
9936333985a6
738 "install world" for pkg
Shawn Walker <shawn.walker@oracle.com>
parents:
2207
diff
changeset
|
546 |
The following pattern(s) only matched packages that are not available |
9936333985a6
738 "install world" for pkg
Shawn Walker <shawn.walker@oracle.com>
parents:
2207
diff
changeset
|
547 |
for the current image's architecture, zone type, and/or other variant:""") |
9936333985a6
738 "install world" for pkg
Shawn Walker <shawn.walker@oracle.com>
parents:
2207
diff
changeset
|
548 |
res += [s] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
549 |
res += ["\t{0}".format(p) for p in self.wrong_variants] |
2212
9936333985a6
738 "install world" for pkg
Shawn Walker <shawn.walker@oracle.com>
parents:
2207
diff
changeset
|
550 |
|
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
551 |
if self.wrong_publishers: |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
552 |
s = _("The following patterns only matched packages " |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
553 |
"that are from publishers other than that which " |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
554 |
"supplied the already installed version of this package") |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
555 |
res += [s] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
556 |
res += ["\t{0}: {1}".format(p[0], ", ".join(p[1])) for p in self.wrong_publishers] |
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
557 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
558 |
if self.multiple_matches: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
559 |
s = _("'{0}' 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
|
560 |
for p, lst in self.multiple_matches: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
561 |
res.append(s.format(p)) |
922
0074b10d84e0
6874 stack trace on install with ambiguous package names
Danek Duvall <danek.duvall@sun.com>
parents:
917
diff
changeset
|
562 |
for pfmri in lst: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
563 |
res.append("\t{0}".format(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
|
564 |
|
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
565 |
if self.missing_matches: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
566 |
s = _("'{0}' matches no installed packages") |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
567 |
res += [ s.format(p) for p in self.missing_matches ] |
616
6d307b088d92
4056 make_uninstall_plan misreports trying to uninstall a known, but uninstalled package
Brock Pytlik <bpytlik@sun.com>
parents:
614
diff
changeset
|
568 |
|
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
569 |
if self.illegal: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
570 |
s = _("'{0}' is an illegal fmri") |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
571 |
res += [ s.format(p) for p in self.illegal ] |
655
6eef82185057
2325 optional dependency enforcement can't handle fmris disappearing from the catalog
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
633
diff
changeset
|
572 |
|
838
aafbe4737188
3245 need to support creation of multi-architecture (fat) packages
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
835
diff
changeset
|
573 |
if self.badarch: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
574 |
s = _("'{p}' supports the following architectures: " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
575 |
"{archs}") |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
576 |
a = _("Image architecture is defined as: {0}") |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
577 |
res += [ s.format(p=self.badarch[0], |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
578 |
archs=", ".join(self.badarch[1]))] |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
579 |
res += [ a.format(self.badarch[2])] |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
580 |
|
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
581 |
s = _("'{p}' depends on obsolete package '{op}'") |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
582 |
res += [ s.format(p=p, op=op) for p, op in self.obsolete ] |
1461
fdf40c8c6765
820 Need a way to obsolete packages
Danek Duvall <danek.duvall@sun.com>
parents:
1431
diff
changeset
|
583 |
|
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
584 |
if self.installed: |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
585 |
s = _("The proposed operation can not be performed for " |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
586 |
"the following package(s) as they are already " |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
587 |
"installed: ") |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
588 |
res += [s] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
589 |
res += ["\t{0}".format(p) for p in self.installed] |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
590 |
|
2453
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
591 |
if self.invalid_mediations: |
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
592 |
s = _("The following mediations are not syntactically " |
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
593 |
"valid:") |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3206
diff
changeset
|
594 |
for m, entries in six.iteritems(self.invalid_mediations): |
2453
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
595 |
for value, error in entries.values(): |
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
596 |
res.append(error) |
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
597 |
|
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
598 |
if self.multispec: |
2681
29aba686b970
7140060 install and update should allow multiple pattern matches when they intersect
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2614
diff
changeset
|
599 |
s = _("The following patterns specify different " |
29aba686b970
7140060 install and update should allow multiple pattern matches when they intersect
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2614
diff
changeset
|
600 |
"versions of the same package(s):") |
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
601 |
res += [s] |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
602 |
for t in self.multispec: |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
603 |
res += [ |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
604 |
", ".join( |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
605 |
[t[i] for i in range(1, len(t))]) |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
606 |
+ ": {0}".format(t[0]) |
1945
a4fc142accb2
16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents:
1937
diff
changeset
|
607 |
] |
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
608 |
if self.no_solution: |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
609 |
res += [_("No solution was found to satisfy constraints")] |
2197
f0a833446218
13054 solver could emit a directed error message for over-revved incorporated pkgs
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2158
diff
changeset
|
610 |
if isinstance(self.no_solution, list): |
f0a833446218
13054 solver could emit a directed error message for over-revved incorporated pkgs
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2158
diff
changeset
|
611 |
res.extend(self.no_solution) |
2207
029ca014fced
17797 plan debugging should also display solver trim database
Shawn Walker <shawn.walker@oracle.com>
parents:
2205
diff
changeset
|
612 |
|
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
613 |
if self.pkg_updates_required: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
614 |
s = _("""\ |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
615 |
Syncing this linked image would require the following package updates: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
616 |
""") |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
617 |
res += [s] |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
618 |
for (oldfmri, newfmri) in self.pkg_updates_required: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
619 |
res += ["{oldfmri} -> {newfmri}\n".format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
620 |
oldfmri=oldfmri, newfmri=newfmri)] |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
621 |
|
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
622 |
if self.no_version: |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
623 |
res += self.no_version |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
624 |
|
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
625 |
if self.no_tmp_origins: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
626 |
s = _(""" |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
627 |
The proposed operation on this parent image can not be performed because |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
628 |
temporary origins were specified and this image has children. Please either |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
629 |
retry the operation again without specifying any temporary origins, or if |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
630 |
packages from additional origins are required, please configure those origins |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
631 |
persistently.""") |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
632 |
res = [s] |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
633 |
|
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
634 |
if self.missing_dependency: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
635 |
res += [_("Package {pkg} is missing a dependency: " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
636 |
"{dep}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
637 |
pkg=self.missing_dependency[0], |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
638 |
dep=self.missing_dependency[1])] |
2200
155eda704b2f
16279 Need a way to revert certain editable files to a as-installed state
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2197
diff
changeset
|
639 |
if self.nofiles: |
155eda704b2f
16279 Need a way to revert certain editable files to a as-installed state
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2197
diff
changeset
|
640 |
res += [_("The following files are not packaged in this image:")] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
641 |
res += ["\t{0}".format(f) for f in self.nofiles] |
1945
a4fc142accb2
16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents:
1937
diff
changeset
|
642 |
|
2207
029ca014fced
17797 plan debugging should also display solver trim database
Shawn Walker <shawn.walker@oracle.com>
parents:
2205
diff
changeset
|
643 |
if self.solver_errors: |
029ca014fced
17797 plan debugging should also display solver trim database
Shawn Walker <shawn.walker@oracle.com>
parents:
2205
diff
changeset
|
644 |
res += ["\n"] |
029ca014fced
17797 plan debugging should also display solver trim database
Shawn Walker <shawn.walker@oracle.com>
parents:
2205
diff
changeset
|
645 |
res += [_("Solver dependency errors:")] |
029ca014fced
17797 plan debugging should also display solver trim database
Shawn Walker <shawn.walker@oracle.com>
parents:
2205
diff
changeset
|
646 |
res.extend(self.solver_errors) |
029ca014fced
17797 plan debugging should also display solver trim database
Shawn Walker <shawn.walker@oracle.com>
parents:
2205
diff
changeset
|
647 |
|
2228
5319ee47781d
2774 new depend action behavior: follow if possible
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2224
diff
changeset
|
648 |
if self.already_installed: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
649 |
res += [_("The following packages are already " |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
650 |
"installed in this image; use uninstall to " |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
651 |
"avoid these:")] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
652 |
res += [ "\t{0}".format(s) for s in self.already_installed] |
2228
5319ee47781d
2774 new depend action behavior: follow if possible
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2224
diff
changeset
|
653 |
|
5319ee47781d
2774 new depend action behavior: follow if possible
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2224
diff
changeset
|
654 |
if self.would_install: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
655 |
res += [_("The following packages are a target " |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
656 |
"of group dependencies; use install to unavoid " |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
657 |
"these:")] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
658 |
res += [ "\t{0}".format(s) for s in self.would_install] |
2228
5319ee47781d
2774 new depend action behavior: follow if possible
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2224
diff
changeset
|
659 |
|
2505
c16c3063cdf7
18560 pkg unavoid is unavoidably broken
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2500
diff
changeset
|
660 |
if self.not_avoided: |
c16c3063cdf7
18560 pkg unavoid is unavoidably broken
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2500
diff
changeset
|
661 |
res += [_("The following packages are not on the " |
c16c3063cdf7
18560 pkg unavoid is unavoidably broken
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2500
diff
changeset
|
662 |
"avoid list, so they\ncannot be removed from it.")] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
663 |
res += [ "\t{0}".format(s) for s in sorted(self.not_avoided)] |
2505
c16c3063cdf7
18560 pkg unavoid is unavoidably broken
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2500
diff
changeset
|
664 |
|
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
665 |
def __format_li_pubs(pubs, res): |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
666 |
i = 0 |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
667 |
for pub, sticky in pubs: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
668 |
s = " {0} {1:d}: {2}".format(_("PUBLISHER"), |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
669 |
i, pub) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
670 |
mod = [] |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
671 |
if not sticky: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
672 |
mod.append(_("non-sticky")) |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
673 |
if mod: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
674 |
s += " ({0})".format(",".join(mod)) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
675 |
res.append(s) |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
676 |
i += 1 |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
677 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
678 |
if self.linked_pub_error: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
679 |
res = [] |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
680 |
(pubs, parent_pubs) = self.linked_pub_error |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
681 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
682 |
res.append(_(""" |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
683 |
Invalid child image publisher configuration. Child image publisher |
2364
7598ee41dcbc
18340 unquoted matching patterns cause spurious test case failures
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2339
diff
changeset
|
684 |
configuration must be a superset of the parent image publisher configuration. |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
685 |
Please update the child publisher configuration to match the parent. If the |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
686 |
child image is a zone this can be done automatically by detaching and |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
687 |
attaching the zone. |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
688 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
689 |
The parent image has the following enabled publishers:""")) |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
690 |
__format_li_pubs(parent_pubs, res) |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
691 |
res.append(_(""" |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
692 |
The child image has the following enabled publishers:""")) |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
693 |
__format_li_pubs(pubs, res) |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
694 |
|
3110
5590234ea9b2
19190899 pkg needs subcommands to dehydrate/rehydrate image
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3107
diff
changeset
|
695 |
if self.no_repo_pubs: |
5590234ea9b2
19190899 pkg needs subcommands to dehydrate/rehydrate image
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3107
diff
changeset
|
696 |
res += [_("The following publishers do not have any " |
5590234ea9b2
19190899 pkg needs subcommands to dehydrate/rehydrate image
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3107
diff
changeset
|
697 |
"configured package repositories and cannot be " |
5590234ea9b2
19190899 pkg needs subcommands to dehydrate/rehydrate image
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3107
diff
changeset
|
698 |
"used in package dehydration or rehydration " |
5590234ea9b2
19190899 pkg needs subcommands to dehydrate/rehydrate image
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3107
diff
changeset
|
699 |
"operations:\n")] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
700 |
res += ["\t{0}".format(s) for s in sorted( |
3110
5590234ea9b2
19190899 pkg needs subcommands to dehydrate/rehydrate image
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3107
diff
changeset
|
701 |
self.no_repo_pubs)] |
5590234ea9b2
19190899 pkg needs subcommands to dehydrate/rehydrate image
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3107
diff
changeset
|
702 |
|
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
703 |
return "\n".join(res) |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
704 |
|
2228
5319ee47781d
2774 new depend action behavior: follow if possible
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2224
diff
changeset
|
705 |
|
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
706 |
class ConflictingActionError(ApiException): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
707 |
"""Used to indicate that the imageplan would result in one or more sets |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
708 |
of conflicting actions, meaning that more than one action would exist on |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
709 |
the system with the same key attribute value in the same namespace. |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
710 |
There are three categories, each with its own subclass: |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
711 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
712 |
- multiple files delivered to the same path or drivers, users, groups, |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
713 |
etc, delivered with the same key attribute; |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
714 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
715 |
- multiple objects delivered to the same path which aren't the same |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
716 |
type; |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
717 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
718 |
- multiple directories, links, or hardlinks delivered to the same path |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
719 |
but with conflicting attributes. |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
720 |
""" |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
721 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
722 |
def __init__(self, data): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
723 |
self._data = data |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
724 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
725 |
class ConflictingActionErrors(ApiException): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
726 |
"""A container for multiple ConflictingActionError exception objects |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
727 |
that can be raised as a single exception.""" |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
728 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
729 |
def __init__(self, errors): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
730 |
self.__errors = errors |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
731 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
732 |
def __str__(self): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
733 |
return "\n\n".join((str(err) for err in self.__errors)) |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
734 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
735 |
class DuplicateActionError(ConflictingActionError): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
736 |
"""Multiple actions of the same type have been delivered with the same |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
737 |
key attribute (when not allowed).""" |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
738 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
739 |
def __str__(self): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
740 |
pfmris = set((a[1] for a in self._data)) |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
741 |
kv = self._data[0][0].attrs[self._data[0][0].key_attr] |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
742 |
action = self._data[0][0].name |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
743 |
if len(pfmris) > 1: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
744 |
s = _("The following packages all deliver {action} " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
745 |
"actions to {kv}:\n").format(**locals()) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
746 |
for a, p in self._data: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
747 |
s += "\n {0}".format(p) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
748 |
s += _("\n\nThese packages may not be installed together. " |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
749 |
"Any non-conflicting set may\nbe, or the packages " |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
750 |
"must be corrected before they can be installed.") |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
751 |
else: |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
752 |
pfmri = pfmris.pop() |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
753 |
s = _("The package {pfmri} delivers multiple copies " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
754 |
"of {action} {kv}").format(**locals()) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
755 |
s += _("\nThis package must be corrected before it " |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
756 |
"can be installed.") |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
757 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
758 |
return s |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
759 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
760 |
class InconsistentActionTypeError(ConflictingActionError): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
761 |
"""Multiple actions of different types have been delivered with the same |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
762 |
'path' attribute. While this exception could represent other action |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
763 |
groups which share a single namespace, none such exist.""" |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
764 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
765 |
def __str__(self): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
766 |
ad = {} |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
767 |
pfmris = set() |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
768 |
kv = self._data[0][0].attrs[self._data[0][0].key_attr] |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
769 |
for a, p in self._data: |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
770 |
ad.setdefault(a.name, []).append(p) |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
771 |
pfmris.add(p) |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
772 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
773 |
if len(pfmris) > 1: |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
774 |
s = _("The following packages deliver conflicting " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
775 |
"action types to {0}:\n").format(kv) |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3206
diff
changeset
|
776 |
for name, pl in six.iteritems(ad): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
777 |
s += "\n {0}:".format(name) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
778 |
s += "".join("\n {0}".format(p) for p in pl) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
779 |
s += _("\n\nThese packages may not be installed together. " |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
780 |
"Any non-conflicting set may\nbe, or the packages " |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
781 |
"must be corrected before they can be installed.") |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
782 |
else: |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
783 |
pfmri = pfmris.pop() |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3206
diff
changeset
|
784 |
types = list_to_lang(list(ad.keys())) |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
785 |
s = _("The package {pfmri} delivers conflicting " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
786 |
"action types ({types}) to {kv}").format(**locals()) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
787 |
s += _("\nThis package must be corrected before it " |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
788 |
"can be installed.") |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
789 |
return s |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
790 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
791 |
class InconsistentActionAttributeError(ConflictingActionError): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
792 |
"""Multiple actions of the same type representing the same object have |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
793 |
have been delivered, but with conflicting attributes, such as two |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
794 |
directories at /usr with groups 'root' and 'sys', or two 'root' users |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
795 |
with uids '0' and '7'.""" |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
796 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
797 |
def __str__(self): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
798 |
actions = self._data |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
799 |
keyattr = actions[0][0].attrs[actions[0][0].key_attr] |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
800 |
actname = actions[0][0].name |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
801 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
802 |
# Trim the action's attributes to only those required to be |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
803 |
# unique. |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
804 |
def ou(action): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
805 |
ua = dict( |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
806 |
(k, v) |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3206
diff
changeset
|
807 |
for k, v in six.iteritems(action.attrs) |
2453
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
808 |
if ((k in action.unique_attrs and |
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
809 |
not (k == "preserve" and "overlay" in action.attrs)) or |
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
810 |
((action.name == "link" or action.name == "hardlink") and |
330443795456
18619 link mediation support needed
Shawn Walker <shawn.walker@oracle.com>
parents:
2452
diff
changeset
|
811 |
k.startswith("mediator"))) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
812 |
) |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
813 |
action.attrs = ua |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
814 |
return action |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
815 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
816 |
d = {} |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
817 |
for a in actions: |
2232
19fb8816dac6
17894 upgrade converting multiples of one type of action to another type fails
Danek Duvall <danek.duvall@oracle.com>
parents:
2228
diff
changeset
|
818 |
if a[0].attrs.get("implicit", "false") == "false": |
19fb8816dac6
17894 upgrade converting multiples of one type of action to another type fails
Danek Duvall <danek.duvall@oracle.com>
parents:
2228
diff
changeset
|
819 |
d.setdefault(str(ou(a[0])), set()).add(a[1]) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
820 |
l = sorted([ |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
821 |
(len(pkglist), action, pkglist) |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3206
diff
changeset
|
822 |
for action, pkglist in six.iteritems(d) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
823 |
]) |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
824 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
825 |
s = _("The requested change to the system attempts to install " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
826 |
"multiple actions\nfor {a} '{k}' with conflicting " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
827 |
"attributes:\n\n").format(a=actname, k=keyattr) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
828 |
allpkgs = set() |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
829 |
for num, action, pkglist in l: |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
830 |
allpkgs.update(pkglist) |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
831 |
if num <= 5: |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
832 |
if num == 1: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
833 |
t = _(" {n:d} package delivers '{a}':\n") |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
834 |
else: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
835 |
t = _(" {n:d} packages deliver '{a}':\n") |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
836 |
s += t.format(n=num, a=action) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
837 |
for pkg in sorted(pkglist): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
838 |
s += _(" {0}\n").format(pkg) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
839 |
else: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
840 |
t = _(" {n:d} packages deliver '{a}', including:\n") |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
841 |
s += t.format(n=num, a=action) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
842 |
for pkg in sorted(pkglist)[:5]: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
843 |
s += _(" {0}\n").format(pkg) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
844 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
845 |
if len(allpkgs) == 1: |
2239
64cd1579ce6a
17933 can't uninstall your way one step at a time from a conflicting scenario
Danek Duvall <danek.duvall@oracle.com>
parents:
2232
diff
changeset
|
846 |
s += _("\nThis package must be corrected before it " |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
847 |
"can be installed.") |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
848 |
else: |
2239
64cd1579ce6a
17933 can't uninstall your way one step at a time from a conflicting scenario
Danek Duvall <danek.duvall@oracle.com>
parents:
2232
diff
changeset
|
849 |
s += _("\nThese packages may not be installed together." |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
850 |
" Any non-conflicting set may\nbe, or the packages " |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
851 |
"must be corrected before they can be installed.") |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
852 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
853 |
return s |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
854 |
|
3206
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
855 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
856 |
class ImageBoundaryError(ApiException): |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
857 |
"""Used to indicate that a file is delivered to image dir""" |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
858 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
859 |
GENERIC = "generic" # generic image boundary violation |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
860 |
OUTSIDE_BE = "outside_be" # deliver items outside boot environment |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
861 |
RESERVED = "reserved" # deliver items to reserved dirs |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
862 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
863 |
def __init__(self, fmri, actions=None): |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
864 |
"""fmri is the package fmri |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
865 |
actions should be a dictionary of which key is the |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
866 |
error type and value is a list of actions""" |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
867 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
868 |
ApiException.__init__(self) |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
869 |
self.fmri = fmri |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
870 |
generic = _("The following items are outside the boundaries " |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
871 |
"of the target image:\n\n") |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
872 |
outside_be = _("The following items are delivered outside " |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
873 |
"the target boot environment:\n\n") |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
874 |
reserved = _("The following items are delivered to " |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
875 |
"reserved directories:\n\n") |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
876 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
877 |
self.message = { |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
878 |
self.GENERIC: generic, |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
879 |
self.OUTSIDE_BE: outside_be, |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
880 |
self.RESERVED: reserved |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
881 |
} |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
882 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
883 |
if actions: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
884 |
self.actions = actions |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
885 |
else: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
886 |
self.actions = {} |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
887 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
888 |
def append_error(self, action, err_type=GENERIC): |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
889 |
"""This function is used to append errors in the error |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
890 |
dictionary""" |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
891 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
892 |
if action: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
893 |
self.actions.setdefault(err_type, []).append(action) |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
894 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
895 |
def isEmpty(self): |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
896 |
"""Return whether error dictionary is empty""" |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
897 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
898 |
return len(self.actions) == 0 |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
899 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
900 |
def __str__(self): |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
901 |
error_list = [self.GENERIC, self.OUTSIDE_BE, self.RESERVED] |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
902 |
s = _("The package {0} delivers items outside the boundaries of" |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
903 |
" the target image and can not be " |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
904 |
"installed.\n\n").format(self.fmri) |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
905 |
for err_type in error_list: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
906 |
if not err_type in self.actions: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
907 |
continue |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
908 |
if self.actions[err_type]: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
909 |
s += self.message[err_type] |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
910 |
for action in self.actions[err_type]: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
911 |
s += (" {0} {1}\n").format( |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
912 |
action.name, action.attrs["path"]) |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
913 |
return s |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
914 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
915 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
916 |
class ImageBoundaryErrors(ApiException): |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
917 |
"""A container for multiple ImageBoundaryError exception objects |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
918 |
that can be raised as a single exception.""" |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
919 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
920 |
def __init__(self, errors): |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
921 |
ApiException.__init__(self) |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
922 |
self.__errors = errors |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
923 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
924 |
generic = _("The following packages deliver items outside " |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
925 |
"the boundaries of the target image and can not be " |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
926 |
"installed:\n\n") |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
927 |
outside_be = _("The following packages deliver items outside " |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
928 |
"the target boot environment and can not be " |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
929 |
"installed:\n\n") |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
930 |
reserved = _("The following packages deliver items to reserved " |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
931 |
"directories and can not be installed:\n\n") |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
932 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
933 |
self.message = { |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
934 |
ImageBoundaryError.GENERIC: generic, |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
935 |
ImageBoundaryError.OUTSIDE_BE: outside_be, |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
936 |
ImageBoundaryError.RESERVED: reserved |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
937 |
} |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
938 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
939 |
def __str__(self): |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
940 |
if len(self.__errors) <= 1: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
941 |
return "\n".join([str(err) for err in self.__errors]) |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
942 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
943 |
s = "" |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
944 |
for err_type in self.message: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
945 |
cur_errs = [] |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
946 |
for err in self.__errors: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
947 |
# If err does not contain this error type |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
948 |
# we just ignore this. |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
949 |
if not err_type in err.actions or \ |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
950 |
not err.actions[err_type]: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
951 |
continue |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
952 |
cur_errs.append(err) |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
953 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
954 |
if not cur_errs: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
955 |
continue |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
956 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
957 |
if len(cur_errs) == 1: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
958 |
fmri = cur_errs[0].fmri |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
959 |
s += _("The package {0} delivers items outside " |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
960 |
"the boundaries of the target image and can " |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
961 |
"not be installed.\n\n").format(fmri) |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
962 |
s += cur_errs[0].message[err_type] |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
963 |
for action in cur_errs[0].actions[err_type]: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
964 |
s += (" {0} {1}\n").format( |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
965 |
action.name, action.attrs["path"]) |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
966 |
s += "\n" |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
967 |
continue |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
968 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
969 |
s += self.message[err_type] |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
970 |
for err in cur_errs: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
971 |
s += (" {0}\n").format(err.fmri) |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
972 |
for action in err.actions[err_type]: |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
973 |
s += (" {0} {1}\n").format( |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
974 |
action.name, action.attrs["path"]) |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
975 |
s += "\n" |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
976 |
return s |
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
977 |
|
04653cad331a
17830136 pkg(5) should enforce image boundaries
Chao Pan <chao.pan@oracle.com>
parents:
3195
diff
changeset
|
978 |
|
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
979 |
def list_to_lang(l): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
980 |
"""Takes a list of items and puts them into a string, with commas in |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
981 |
between items, and an "and" between the last two items. Special cases |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
982 |
for lists of two or fewer items, and uses the Oxford comma.""" |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
983 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
984 |
if not l: |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
985 |
return "" |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
986 |
if len(l) == 1: |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
987 |
return l[0] |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
988 |
if len(l) == 2: |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
989 |
# Used for a two-element list |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
990 |
return _("{penultimate} and {ultimate}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
991 |
penultimate=l[0], |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
992 |
ultimate=l[1] |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
993 |
) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
994 |
# In order to properly i18n this construct, we create two templates: |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
995 |
# one for each element save the last, and one that tacks on the last |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
996 |
# element. |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
997 |
# 'elementtemplate' is for each element through the penultimate |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
998 |
elementtemplate = _("{0}, ") |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
999 |
# 'listtemplate' concatenates the concatenation of non-ultimate elements |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1000 |
# and the ultimate element. |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1001 |
listtemplate = _("{list}and {tail}") |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1002 |
return listtemplate.format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1003 |
list="".join(elementtemplate.format(i) for i in l[:-1]), |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1004 |
tail=l[-1] |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1005 |
) |
1068
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
1006 |
|
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
|
1007 |
class ActionExecutionError(ApiException): |
1859
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1008 |
"""Used to indicate that action execution (such as install, remove, |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1009 |
etc.) failed even though the action is valid. |
1050
54c841d1fad9
1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents:
1027
diff
changeset
|
1010 |
|
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
|
1011 |
In particular, this exception indicates that something went wrong in the |
1859
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1012 |
application (or unapplication) of the action to the system, and is most |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1013 |
likely not an error in the pkg(5) code.""" |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1014 |
|
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1015 |
def __init__(self, action, details=None, error=None, fmri=None, |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1016 |
use_errno=None): |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1017 |
"""'action' is the object for the action that failed during the |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1018 |
requested operation. |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1019 |
|
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1020 |
'details' is an optional message explaining what operation |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1021 |
failed, why it failed, and why it cannot continue. It should |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1022 |
also include a suggestion as to how to resolve the situation |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1023 |
if possible. |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1024 |
|
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1025 |
'error' is an optional exception object that may have been |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1026 |
raised when the operation failed. |
1050
54c841d1fad9
1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents:
1027
diff
changeset
|
1027 |
|
1859
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1028 |
'fmri' is an optional package FMRI indicating what package |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1029 |
was being operated on at the time the error occurred. |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1030 |
|
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1031 |
'use_errno' is an optional boolean value indicating whether |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1032 |
the strerror() text of the exception should be used. If |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1033 |
'details' is provided, the default value is False, otherwise |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1034 |
True.""" |
1050
54c841d1fad9
1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents:
1027
diff
changeset
|
1035 |
|
1859
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1036 |
assert (details or error) |
1050
54c841d1fad9
1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents:
1027
diff
changeset
|
1037 |
self.action = action |
1859
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1038 |
self.details = details |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1039 |
self.error = error |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1040 |
self.fmri = fmri |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1041 |
if use_errno == None: |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1042 |
# If details were provided, don't use errno unless |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1043 |
# explicitly requested. |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1044 |
use_errno = not details |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1045 |
self.use_errno = use_errno |
1050
54c841d1fad9
1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents:
1027
diff
changeset
|
1046 |
|
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
|
1047 |
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
|
1048 |
errno = "" |
1859
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1049 |
if self.use_errno and self.error and \ |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1050 |
hasattr(self.error, "errno"): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1051 |
errno = "[errno {0:d}: {1}]".format(self.error.errno, |
1859
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1052 |
os.strerror(self.error.errno)) |
1050
54c841d1fad9
1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents:
1027
diff
changeset
|
1053 |
|
1859
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1054 |
details = self.details or "" |
1050
54c841d1fad9
1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents:
1027
diff
changeset
|
1055 |
|
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
|
1056 |
# 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
|
1057 |
# useful. |
1859
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1058 |
if not errno and not details: |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1059 |
return str(self.error) |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1060 |
|
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1061 |
if errno and details: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1062 |
details = "{0}: {1}".format(errno, details) |
1050
54c841d1fad9
1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents:
1027
diff
changeset
|
1063 |
|
1859
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1064 |
if details and not self.fmri: |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1065 |
details = _("Requested operation failed for action " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1066 |
"{action}:\n{details}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1067 |
action=self.action, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1068 |
details=details) |
1859
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1069 |
elif details: |
6e6e866921e7
529 client can traceback with EBUSY during action removal
Shawn Walker <shawn.walker@oracle.com>
parents:
1755
diff
changeset
|
1070 |
details = _("Requested operation failed for package " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1071 |
"{fmri}:\n{details}").format(fmri=self.fmri, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1072 |
details=details) |
1050
54c841d1fad9
1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents:
1027
diff
changeset
|
1073 |
|
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
|
1074 |
# If we only have one of the two, no need for the colon. |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1075 |
return "{0}{1}".format(errno, details) |
1050
54c841d1fad9
1770 Invalid "Not owner" error when path is delivered as both directory and symlink
Danek Duvall <danek.duvall@sun.com>
parents:
1027
diff
changeset
|
1076 |
|
1068
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
1077 |
|
3293
a3347e4614da
15715250 implicit catalog refreshes shouldn't fail if publishers are unreachable
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
3245
diff
changeset
|
1078 |
class CatalogOriginRefreshException(ApiException): |
a3347e4614da
15715250 implicit catalog refreshes shouldn't fail if publishers are unreachable
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
3245
diff
changeset
|
1079 |
def __init__(self, failed, total, errmessage=None): |
a3347e4614da
15715250 implicit catalog refreshes shouldn't fail if publishers are unreachable
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
3245
diff
changeset
|
1080 |
ApiException.__init__(self) |
a3347e4614da
15715250 implicit catalog refreshes shouldn't fail if publishers are unreachable
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
3245
diff
changeset
|
1081 |
self.failed = failed |
a3347e4614da
15715250 implicit catalog refreshes shouldn't fail if publishers are unreachable
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
3245
diff
changeset
|
1082 |
self.total = total |
a3347e4614da
15715250 implicit catalog refreshes shouldn't fail if publishers are unreachable
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
3245
diff
changeset
|
1083 |
self.errmessage = errmessage |
a3347e4614da
15715250 implicit catalog refreshes shouldn't fail if publishers are unreachable
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
3245
diff
changeset
|
1084 |
|
a3347e4614da
15715250 implicit catalog refreshes shouldn't fail if publishers are unreachable
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
3245
diff
changeset
|
1085 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1086 |
class CatalogRefreshException(ApiException): |
1603
84bd53597209
13019 DeprecationWarnings seen after python 2.6 migration
Dan Price <dp@eng.sun.com>
parents:
1540
diff
changeset
|
1087 |
def __init__(self, failed, total, succeeded, errmessage=None): |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1088 |
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
|
1089 |
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
|
1090 |
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
|
1091 |
self.succeeded = succeeded |
1603
84bd53597209
13019 DeprecationWarnings seen after python 2.6 migration
Dan Price <dp@eng.sun.com>
parents:
1540
diff
changeset
|
1092 |
self.errmessage = errmessage |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1093 |
|
1068
9400aa8afd32
2557 catalog cache pickle file dependent on fmri and version object definitions
Shawn Walker <srw@sun.com>
parents:
1053
diff
changeset
|
1094 |
|
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1095 |
class CatalogError(ApiException): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1096 |
"""Base exception class for all catalog exceptions.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1097 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1098 |
def __init__(self, *args, **kwargs): |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1099 |
ApiException.__init__(self) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1100 |
if args: |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1101 |
self.data = args[0] |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1102 |
else: |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1103 |
self.data = None |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
1104 |
self._args = kwargs |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1105 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1106 |
def __str__(self): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1107 |
return str(self.data) |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1108 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1109 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1110 |
class AnarchicalCatalogFMRI(CatalogError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1111 |
"""Used to indicate that the specified FMRI is not valid for catalog |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1112 |
operations because it is missing publisher information.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1113 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1114 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1115 |
return _("The FMRI '{0}' does not contain publisher information " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1116 |
"and cannot be used for catalog operations.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1117 |
self.data) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1118 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1119 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1120 |
class BadCatalogMetaRoot(CatalogError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1121 |
"""Used to indicate an operation on the catalog's meta_root failed |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1122 |
because the meta_root is invalid.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1123 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1124 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1125 |
return _("Catalog meta_root '{root}' is invalid; unable " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1126 |
"to complete operation: '{op}'.").format(root=self.data, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1127 |
op=self._args.get("operation", None)) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1128 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1129 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1130 |
class BadCatalogPermissions(CatalogError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1131 |
"""Used to indicate the server catalog files do not have the expected |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1132 |
permissions.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1133 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1134 |
def __init__(self, files): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1135 |
"""files should contain a list object with each entry consisting |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1136 |
of a tuple of filename, expected_mode, received_mode.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1137 |
if not files: |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1138 |
files = [] |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1139 |
CatalogError.__init__(self, files) |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1140 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1141 |
def __str__(self): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1142 |
msg = _("The following catalog files have incorrect " |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1143 |
"permissions:\n") |
2614
be07075b6fd3
19146 catalog permission error exception omits file permission list when stringified
Shawn Walker <shawn.walker@oracle.com>
parents:
2612
diff
changeset
|
1144 |
for f in self.data: |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1145 |
fname, emode, fmode = f |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1146 |
msg += _("\t{fname}: expected mode: {emode}, found " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1147 |
"mode: {fmode}\n").format(fname=fname, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1148 |
emode=emode, fmode=fmode) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1149 |
return msg |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1150 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1151 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1152 |
class BadCatalogSignatures(CatalogError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1153 |
"""Used to indicate that the Catalog signatures are not valid.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1154 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1155 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1156 |
return _("The signature data for the '{0}' catalog file is not " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1157 |
"valid.").format(self.data) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1158 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1159 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1160 |
class BadCatalogUpdateIdentity(CatalogError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1161 |
"""Used to indicate that the requested catalog updates could not be |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1162 |
applied as the new catalog data is significantly different such that |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1163 |
the old catalog cannot be updated to match it.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1164 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1165 |
def __str__(self): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1166 |
return _("Unable to determine the updates needed for " |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1167 |
"the current catalog using the provided catalog " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1168 |
"update data in '{0}'.").format(self.data) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1169 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1170 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1171 |
class DuplicateCatalogEntry(CatalogError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1172 |
"""Used to indicate that the specified catalog operation could not be |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1173 |
performed since it would result in a duplicate catalog entry.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1174 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1175 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1176 |
return _("Unable to perform '{op}' operation for catalog " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1177 |
"{name}; completion would result in a duplicate entry " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1178 |
"for package '{fmri}'.").format(op=self._args.get( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1179 |
"operation", None), name=self._args.get("catalog_name", |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1180 |
None), fmri=self.data) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1181 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1182 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1183 |
class CatalogUpdateRequirements(CatalogError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1184 |
"""Used to indicate that an update request for the catalog could not |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1185 |
be performed because update requirements were not satisfied.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1186 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1187 |
def __str__(self): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1188 |
return _("Catalog updates can only be applied to an on-disk " |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1189 |
"catalog.") |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1190 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1191 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1192 |
class InvalidCatalogFile(CatalogError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1193 |
"""Used to indicate a Catalog file could not be loaded.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1194 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1195 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1196 |
return _("Catalog file '{0}' is invalid.\nUse 'pkgrepo rebuild' " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1197 |
"to create a new package catalog.").format(self.data) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1198 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1199 |
|
2022
40fbda1e14b7
16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents:
1970
diff
changeset
|
1200 |
class MismatchedCatalog(CatalogError): |
40fbda1e14b7
16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents:
1970
diff
changeset
|
1201 |
"""Used to indicate that a Catalog's attributes and parts do not |
40fbda1e14b7
16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents:
1970
diff
changeset
|
1202 |
match. This is likely the result of an attributes file being |
40fbda1e14b7
16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents:
1970
diff
changeset
|
1203 |
retrieved which doesn't match the parts that were retrieved such |
40fbda1e14b7
16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents:
1970
diff
changeset
|
1204 |
as in a misconfigured or stale cache case.""" |
40fbda1e14b7
16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents:
1970
diff
changeset
|
1205 |
|
40fbda1e14b7
16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents:
1970
diff
changeset
|
1206 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1207 |
return _("The content of the catalog for publisher '{0}' " |
2022
40fbda1e14b7
16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents:
1970
diff
changeset
|
1208 |
"doesn't match the catalog's attributes. This is " |
40fbda1e14b7
16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents:
1970
diff
changeset
|
1209 |
"likely the result of a mix of older and newer " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1210 |
"catalog files being provided for the publisher.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1211 |
self.data) |
2022
40fbda1e14b7
16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents:
1970
diff
changeset
|
1212 |
|
40fbda1e14b7
16715 publisher refresh should validate retrieved catalog parts using catalog attributes
Shawn Walker <shawn.walker@oracle.com>
parents:
1970
diff
changeset
|
1213 |
|
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1214 |
class ObsoleteCatalogUpdate(CatalogError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1215 |
"""Used to indicate that the specified catalog updates are for an older |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1216 |
version of the catalog and cannot be applied.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1217 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1218 |
def __str__(self): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1219 |
return _("Unable to determine the updates needed for the " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1220 |
"catalog using the provided catalog update data in '{0}'. " |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1221 |
"The specified catalog updates are for an older version " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1222 |
"of the catalog and cannot be used.").format(self.data) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1223 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1224 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1225 |
class UnknownCatalogEntry(CatalogError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1226 |
"""Used to indicate that an entry for the specified package FMRI or |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1227 |
pattern could not be found in the catalog.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1228 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1229 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1230 |
return _("'{0}' could not be found in the catalog.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1231 |
self.data) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1232 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1233 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1234 |
class UnknownUpdateType(CatalogError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1235 |
"""Used to indicate that the specified CatalogUpdate operation is |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1236 |
unknown.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1237 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1238 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1239 |
return _("Unknown catalog update type '{0}'").format(self.data) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1240 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1241 |
|
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
1242 |
class UnrecognizedCatalogPart(CatalogError): |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
1243 |
"""Raised when the catalog finds a CatalogPart that is unrecognized |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
1244 |
or invalid.""" |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
1245 |
|
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
1246 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1247 |
return _("Unrecognized, unknown, or invalid CatalogPart '{0}'").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1248 |
self.data) |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
1249 |
|
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
1250 |
|
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1251 |
class InventoryException(ApiException): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1252 |
"""Used to indicate that some of the specified patterns to a catalog |
1970
60471574c487
16238 client api should ignore invalid and not yet supported packages
Shawn Walker <shawn.walker@oracle.com>
parents:
1968
diff
changeset
|
1253 |
matching function did not match any catalog entries, or were invalid |
60471574c487
16238 client api should ignore invalid and not yet supported packages
Shawn Walker <shawn.walker@oracle.com>
parents:
1968
diff
changeset
|
1254 |
patterns.""" |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1255 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1256 |
def __init__(self, illegal=EmptyI, matcher=EmptyI, notfound=EmptyI, |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1257 |
publisher=EmptyI, version=EmptyI): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1258 |
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
|
1259 |
self.illegal = illegal |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1260 |
self.matcher = matcher |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1261 |
self.notfound = set(notfound) |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1262 |
self.publisher = publisher |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1263 |
self.version = version |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1264 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1265 |
self.notfound.update(matcher) |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1266 |
self.notfound.update(publisher) |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1267 |
self.notfound.update(version) |
3107
29c1f669929a
15695560 pkg list should spread errors over multiple lines
Aditya Tuteja <aditya.tuteja@oracle.com>
parents:
3098
diff
changeset
|
1268 |
self.notfound = sorted(list(self.notfound)) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1269 |
|
1945
a4fc142accb2
16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents:
1937
diff
changeset
|
1270 |
assert self.illegal or self.notfound |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1271 |
|
596
f4519e2a99bc
3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
565
diff
changeset
|
1272 |
def __str__(self): |
f4519e2a99bc
3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
565
diff
changeset
|
1273 |
outstr = "" |
f4519e2a99bc
3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
565
diff
changeset
|
1274 |
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
|
1275 |
# Illegal FMRIs have their own __str__ method |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1276 |
outstr += "{0}\n".format(x) |
614
4b620a1e8c01
4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
596
diff
changeset
|
1277 |
|
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1278 |
if self.matcher or self.publisher or self.version: |
614
4b620a1e8c01
4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
596
diff
changeset
|
1279 |
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
|
1280 |
"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
|
1281 |
"the current publishers:\n") |
614
4b620a1e8c01
4080 Inventory Exception is overly verbose
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
596
diff
changeset
|
1282 |
|
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1283 |
for x in self.matcher: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1284 |
outstr += \ |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1285 |
_("{0} (pattern did not match)\n").format(x) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1286 |
for x in self.publisher: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1287 |
outstr += _("{0} (publisher did not " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1288 |
"match)\n").format(x) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
1289 |
for x in self.version: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1290 |
outstr += \ |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1291 |
_("{0} (version did not match)\n").format(x) |
596
f4519e2a99bc
3704 InventoryException raised if optional dependencies not in catalog
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
565
diff
changeset
|
1292 |
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
|
1293 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
1294 |
|
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1295 |
# SearchExceptions |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1296 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
1297 |
class SearchException(ApiException): |
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
1298 |
"""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
|
1299 |
pass |
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
1300 |
|
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
1301 |
|
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1302 |
class MalformedSearchRequest(SearchException): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1303 |
"""Raised when the server cannot understand the format of the |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1304 |
search request.""" |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1305 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1306 |
def __init__(self, url): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1307 |
SearchException.__init__(self) |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1308 |
self.url = url |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1309 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1310 |
def __str__(self): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1311 |
return str(self.url) |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1312 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1313 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1314 |
class NegativeSearchResult(SearchException): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1315 |
"""Returned when the search cannot find any matches.""" |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1316 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1317 |
def __init__(self, url): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1318 |
SearchException.__init__(self) |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1319 |
self.url = url |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1320 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1321 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1322 |
return _("The search at url {0} returned no results.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1323 |
self.url) |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1324 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1325 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1326 |
class ProblematicSearchServers(SearchException): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1327 |
"""This class wraps exceptions which could appear while trying to |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1328 |
do a search request.""" |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1329 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1330 |
def __init__(self, failed=EmptyI, invalid=EmptyI, unsupported=EmptyI): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1331 |
SearchException.__init__(self) |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1332 |
self.failed_servers = failed |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1333 |
self.invalid_servers = invalid |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1334 |
self.unsupported_servers = unsupported |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1335 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1336 |
def __str__(self): |
1895
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1859
diff
changeset
|
1337 |
s = _("Some repositories failed to respond appropriately:\n") |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1338 |
for pub, err in self.failed_servers: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1339 |
s += _("{o}:\n{msg}\n").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1340 |
o=pub, msg=err) |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1341 |
for pub in self.invalid_servers: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1342 |
s += _("{0} did not return a valid " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1343 |
"response.\n".format(pub)) |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1344 |
if len(self.unsupported_servers) > 0: |
1895
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1859
diff
changeset
|
1345 |
s += _("Some repositories don't support requested " |
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1859
diff
changeset
|
1346 |
"search operation:\n") |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1347 |
for pub, err in self.unsupported_servers: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1348 |
s += _("{o}:\n{msg}\n").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1349 |
o=pub, msg=err) |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1350 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1351 |
return s |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1352 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1353 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1354 |
class SlowSearchUsed(SearchException): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1355 |
"""This exception is thrown when a local search is performed without |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1356 |
an index. It's raised after all results have been yielded.""" |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1357 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1358 |
def __str__(self): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1359 |
return _("Search performance is degraded.\n" |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1360 |
"Run 'pkg rebuild-index' to improve search speed.") |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1361 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1362 |
|
3245
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1363 |
@total_ordering |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1364 |
class UnsupportedSearchError(SearchException): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1365 |
"""Returned when a search protocol is not supported by the |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1366 |
remote server.""" |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1367 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1368 |
def __init__(self, url=None, proto=None): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1369 |
SearchException.__init__(self) |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1370 |
self.url = url |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1371 |
self.proto = proto |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1372 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1373 |
def __str__(self): |
1895
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1859
diff
changeset
|
1374 |
s = _("Search repository does not support the requested " |
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1859
diff
changeset
|
1375 |
"protocol:") |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1376 |
if self.url: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1377 |
s += "\nRepository URL: {0}".format(self.url) |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1378 |
if self.proto: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1379 |
s += "\nRequested operation: {0}".format(self.proto) |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1380 |
return s |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1381 |
|
3245
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1382 |
def __eq__(self, other): |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1383 |
if not isinstance(other, UnsupportedSearchError): |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1384 |
return False |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1385 |
return self.url == other.url and \ |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1386 |
self.proto == other.proto |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1387 |
|
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1388 |
def __le__(self, other): |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1389 |
if not isinstance(other, UnsupportedSearchError): |
3245
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1390 |
return True |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1391 |
if self.url < other.url: |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1392 |
return True |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1393 |
if self.url != other.url: |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1394 |
return False |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1395 |
return self.proto < other.proto |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1396 |
|
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1397 |
def __hash__(self): |
d04bb3ca0128
20780066 change ordering comparisons for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3244
diff
changeset
|
1398 |
return hash((self.url, self.proto)) |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1399 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1400 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1401 |
# IndexingExceptions. |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1402 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
1403 |
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
|
1404 |
""" 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
|
1405 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1406 |
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
|
1407 |
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
|
1408 |
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
|
1409 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
1410 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1411 |
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
|
1412 |
"""This is used when the index is not in a correct state.""" |
2976
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
1413 |
def __str__(self): |
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
1414 |
return _("The search index appears corrupted.") |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1415 |
|
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
1416 |
|
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1417 |
class InconsistentIndexException(IndexingException): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1418 |
"""This is used when the existing index is found to have inconsistent |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1419 |
versions.""" |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1420 |
def __init__(self, e): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1421 |
IndexingException.__init__(self, e) |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1422 |
self.exception = e |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1423 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1424 |
def __str__(self): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1425 |
return str(self.exception) |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1426 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1427 |
|
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1428 |
class IndexLockedException(IndexingException): |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1429 |
"""This is used when an attempt to modify an index locked by another |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1430 |
process or thread is made.""" |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1431 |
|
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1432 |
def __init__(self, e): |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1433 |
IndexingException.__init__(self, e) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1434 |
self.exception = e |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1435 |
|
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1436 |
def __str__(self): |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1437 |
return str(self.exception) |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1438 |
|
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1439 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1440 |
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
|
1441 |
""" 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
|
1442 |
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
|
1443 |
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
|
1444 |
return "Could not remove or create " \ |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1445 |
"{0} because of incorrect " \ |
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1446 |
"permissions. Please correct this issue then " \ |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1447 |
"rebuild the index.".format(self.cause) |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1448 |
|
1286
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1449 |
class WrapIndexingException(ApiException): |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1450 |
"""This exception is used to wrap an indexing exception during install, |
2089
c8b9d6341530
2775 pkg should provide a way to downgrade (reinstall) packages
Shawn Walker <shawn.walker@oracle.com>
parents:
2073
diff
changeset
|
1451 |
uninstall, or update so that a more appropriate error message can be |
c8b9d6341530
2775 pkg should provide a way to downgrade (reinstall) packages
Shawn Walker <shawn.walker@oracle.com>
parents:
2073
diff
changeset
|
1452 |
displayed to the user.""" |
1286
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1453 |
|
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1454 |
def __init__(self, e, tb, stack): |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1455 |
ApiException.__init__(self) |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1456 |
self.wrapped = e |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1457 |
self.tb = tb |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1458 |
self.stack = stack |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1459 |
|
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1460 |
def __str__(self): |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1461 |
tmp = self.tb.split("\n") |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1462 |
res = tmp[:1] + [s.rstrip("\n") for s in self.stack] + tmp[1:] |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1463 |
return "\n".join(res) |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1464 |
|
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1465 |
|
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1466 |
class WrapSuccessfulIndexingException(WrapIndexingException): |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1467 |
"""This exception is used to wrap an indexing exception during install, |
2089
c8b9d6341530
2775 pkg should provide a way to downgrade (reinstall) packages
Shawn Walker <shawn.walker@oracle.com>
parents:
2073
diff
changeset
|
1468 |
uninstall, or update which was recovered from by performing a full |
c8b9d6341530
2775 pkg should provide a way to downgrade (reinstall) packages
Shawn Walker <shawn.walker@oracle.com>
parents:
2073
diff
changeset
|
1469 |
reindex.""" |
1286
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1470 |
pass |
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1471 |
|
2e5bb564a9e2
8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents:
1256
diff
changeset
|
1472 |
|
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1473 |
# Query Parsing Exceptions |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1474 |
class BooleanQueryException(ApiException): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1475 |
"""This exception is used when the children of a boolean operation |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1476 |
have different return types. The command 'pkg search foo AND <bar>' |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1477 |
is the simplest example of this.""" |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1478 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1479 |
def __init__(self, e): |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1480 |
ApiException.__init__(self) |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1481 |
self.e = e |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1482 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1483 |
def __str__(self): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1484 |
return str(self.e) |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1485 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1486 |
|
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1487 |
class ParseError(ApiException): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1488 |
def __init__(self, e): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1489 |
ApiException.__init__(self) |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1490 |
self.e = e |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1491 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1492 |
def __str__(self): |
1027
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
1493 |
return str(self.e) |
e827313523d8
7774 image history discarded when bootenv operations fail or succeed
Shawn Walker <srw@sun.com>
parents:
1019
diff
changeset
|
1494 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1495 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1496 |
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
|
1497 |
"""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
|
1498 |
|
565
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1499 |
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
|
1500 |
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
|
1501 |
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
|
1502 |
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
|
1503 |
""" |
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1504 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1505 |
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
|
1506 |
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
|
1507 |
|
1fb4f05220b9
3443 An api needs to be provided for safe interaction of front-ends
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
1508 |
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
|
1509 |
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
|
1510 |
|
2976
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
1511 |
def __str__(self): |
3094
15de2efea709
15618618 solver plan errors could explain incorporation-related failures better
Shawn Walker <shawn.walker@oracle.com>
parents:
3065
diff
changeset
|
1512 |
s = _("Unable to remove '{0}' due to the following packages " |
15de2efea709
15618618 solver plan errors could explain incorporation-related failures better
Shawn Walker <shawn.walker@oracle.com>
parents:
3065
diff
changeset
|
1513 |
"that depend on it:\n").format(self.fmri.get_short_fmri( |
15de2efea709
15618618 solver plan errors could explain incorporation-related failures better
Shawn Walker <shawn.walker@oracle.com>
parents:
3065
diff
changeset
|
1514 |
anarchy=True, include_scheme=False)) |
15de2efea709
15618618 solver plan errors could explain incorporation-related failures better
Shawn Walker <shawn.walker@oracle.com>
parents:
3065
diff
changeset
|
1515 |
skey = operator.attrgetter('pkg_name') |
15de2efea709
15618618 solver plan errors could explain incorporation-related failures better
Shawn Walker <shawn.walker@oracle.com>
parents:
3065
diff
changeset
|
1516 |
s += "\n".join( |
15de2efea709
15618618 solver plan errors could explain incorporation-related failures better
Shawn Walker <shawn.walker@oracle.com>
parents:
3065
diff
changeset
|
1517 |
" {0}".format(f.get_short_fmri(anarchy=True, |
15de2efea709
15618618 solver plan errors could explain incorporation-related failures better
Shawn Walker <shawn.walker@oracle.com>
parents:
3065
diff
changeset
|
1518 |
include_scheme=False)) |
15de2efea709
15618618 solver plan errors could explain incorporation-related failures better
Shawn Walker <shawn.walker@oracle.com>
parents:
3065
diff
changeset
|
1519 |
for f in sorted(self.dependents, key=skey) |
15de2efea709
15618618 solver plan errors could explain incorporation-related failures better
Shawn Walker <shawn.walker@oracle.com>
parents:
3065
diff
changeset
|
1520 |
) |
2976
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
1521 |
return s |
b0709e36adb7
17478321 NonLeafPackageException has no associated text
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2974
diff
changeset
|
1522 |
|
3293
a3347e4614da
15715250 implicit catalog refreshes shouldn't fail if publishers are unreachable
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
3245
diff
changeset
|
1523 |
|
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1524 |
def _str_autofix(self): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1525 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1526 |
if getattr(self, "_autofix_pkgs", []): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1527 |
s = _("\nThis is happening because the following " |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1528 |
"packages needed to be repaired as\npart of this " |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1529 |
"operation:\n\n ") |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1530 |
s += "\n ".join(str(f) for f in self._autofix_pkgs) |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1531 |
s += _("\n\nYou will need to reestablish your access to the " |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1532 |
"repository or remove the\npackages in the list above.") |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1533 |
return s |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1534 |
return "" |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1535 |
|
3293
a3347e4614da
15715250 implicit catalog refreshes shouldn't fail if publishers are unreachable
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
3245
diff
changeset
|
1536 |
|
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
|
1537 |
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
|
1538 |
"""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
|
1539 |
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
|
1540 |
def __init__(self, url, data): |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1541 |
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
|
1542 |
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
|
1543 |
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
|
1544 |
|
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
|
1545 |
def __str__(self): |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1546 |
s = _("Unable to contact valid package repository") |
835
34ec4401dc48
686 Client needs a way to tell that a response is actually from an IPS server
johansen <johansen@sun.com>
parents:
717
diff
changeset
|
1547 |
if self.url: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1548 |
s += _(": {0}").format(self.url) |
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
|
1549 |
if self.data: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1550 |
s += ("\nEncountered the following error(s):\n{0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1551 |
self.data) |
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1552 |
|
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1553 |
s += _str_autofix(self) |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1554 |
|
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
|
1555 |
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
|
1556 |
|
3293
a3347e4614da
15715250 implicit catalog refreshes shouldn't fail if publishers are unreachable
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
3245
diff
changeset
|
1557 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1558 |
class DataError(ApiException): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1559 |
"""Base exception class used for all data related errors.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1560 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1561 |
def __init__(self, *args, **kwargs): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1562 |
ApiException.__init__(self, *args) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1563 |
if args: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1564 |
self.data = args[0] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1565 |
else: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1566 |
self.data = None |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
1567 |
self._args = kwargs |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1568 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1569 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1570 |
class InvalidP5IFile(DataError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1571 |
"""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
|
1572 |
valid p5i-formatted file.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1573 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1574 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1575 |
if self.data: |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
1576 |
return _("The provided p5i data is in an unrecognized " |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1577 |
"format or does not contain valid publisher " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1578 |
"information: {0}").format(self.data) |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
1579 |
return _("The provided p5i data is in an unrecognized format " |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
1580 |
"or does not contain valid publisher information.") |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1581 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1582 |
|
2310
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1583 |
class InvalidP5SFile(DataError): |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1584 |
"""Used to indicate that the specified location does not contain a |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1585 |
valid p5i-formatted file.""" |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1586 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1587 |
def __str__(self): |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1588 |
if self.data: |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1589 |
return _("The provided p5s data is in an unrecognized " |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1590 |
"format or does not contain valid publisher " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1591 |
"information: {0}").format(self.data) |
2310
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1592 |
return _("The provided p5s data is in an unrecognized format " |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1593 |
"or does not contain valid publisher information.") |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1594 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1595 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1596 |
class UnsupportedP5IFile(DataError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1597 |
"""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
|
1598 |
of pkg(5) info file was attempted.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1599 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1600 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1601 |
return _("Unsupported pkg(5) publisher information data " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1602 |
"format.") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1603 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1604 |
|
2310
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1605 |
class UnsupportedP5SFile(DataError): |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1606 |
"""Used to indicate that an attempt to read an unsupported version |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1607 |
of pkg(5) info file was attempted.""" |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1608 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1609 |
def __str__(self): |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1610 |
return _("Unsupported pkg(5) publisher and image information " |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1611 |
"data format.") |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1612 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1613 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1614 |
class UnsupportedP5SVersion(ApiException): |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1615 |
"""Used to indicate that an attempt to read an unsupported version |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1616 |
of pkg(5) info file was attempted.""" |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1617 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1618 |
def __init__(self, v): |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1619 |
self.version = v |
2875
09e276ba70c6
15804991 option mangling and verification should be part of the API, not the CLI client
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2847
diff
changeset
|
1620 |
|
2310
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1621 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1622 |
return _("{0} is not a supported version for creating a " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1623 |
"syspub response.").format(self.version) |
2310
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1624 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
1625 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1626 |
class TransportError(ApiException): |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1627 |
"""Abstract exception class for all transport exceptions. |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1628 |
Specific transport exceptions should be implemented in the |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1629 |
transport code. Callers wishing to catch transport exceptions |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1630 |
should use this class. Subclasses must implement all methods |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1631 |
defined here that raise NotImplementedError.""" |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1632 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1633 |
def __str__(self): |
1540
de040c9fd0c0
13003 exception messages not always displayed correctly with python 2.6
Shawn Walker <srw@sun.com>
parents:
1516
diff
changeset
|
1634 |
raise NotImplementedError() |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1635 |
|
2205
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1636 |
def _str_autofix(self): |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1637 |
return _str_autofix(self) |
53d0be594162
3822 image plans should prevent conflicting actions from being installed
Danek Duvall <danek.duvall@oracle.com>
parents:
2200
diff
changeset
|
1638 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1639 |
|
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1640 |
class RetrievalError(ApiException): |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1641 |
"""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
|
1642 |
retrieved.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1643 |
|
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1644 |
def __init__(self, data, location=None): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1645 |
ApiException.__init__(self) |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1646 |
self.data = data |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1647 |
self.location = location |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1648 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1649 |
def __str__(self): |
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1650 |
if self.location: |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1651 |
return _("Error encountered while retrieving data from " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1652 |
"'{location}':\n{data}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1653 |
location=self.location, data=self.data) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1654 |
return _("Error encountered while retrieving data from: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1655 |
self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1656 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1657 |
|
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1658 |
class InvalidResourceLocation(ApiException): |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1659 |
"""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
|
1660 |
|
1191
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1661 |
def __init__(self, data): |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1662 |
ApiException.__init__(self) |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1663 |
self.data = data |
a48bee2a4b2e
305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents:
1182
diff
changeset
|
1664 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1665 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1666 |
return _("'{0}' is not a valid location.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1667 |
|
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1668 |
class BEException(ApiException): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1669 |
def __init__(self): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1670 |
ApiException.__init__(self) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1671 |
|
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
|
1672 |
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
|
1673 |
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
|
1674 |
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
|
1675 |
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
|
1676 |
|
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
|
1677 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1678 |
return _("'{0}' is not a valid boot environment name.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1679 |
self.be_name) |
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
|
1680 |
|
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
|
1681 |
class DuplicateBEName(BEException): |
1945
a4fc142accb2
16111 pkgdepend expands format strings before passing through gettext
Richard Lowe <richlowe@richlowe.net>
parents:
1937
diff
changeset
|
1682 |
"""Used to indicate that there is an existing boot environment |
1076
db86977aa656
8048 image update doesn't check to see if specified be-name already exists
Rich Burridge <rich.burridge@sun.com>
parents:
1068
diff
changeset
|
1683 |
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
|
1684 |
|
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
|
1685 |
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
|
1686 |
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
|
1687 |
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
|
1688 |
|
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
|
1689 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1690 |
return _("The boot environment '{0}' already exists.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1691 |
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
|
1692 |
|
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
|
1693 |
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
|
1694 |
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
|
1695 |
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
|
1696 |
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
|
1697 |
|
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
|
1698 |
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
|
1699 |
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
|
1700 |
Boot environment naming during package install is not supported on this |
2089
c8b9d6341530
2775 pkg should provide a way to downgrade (reinstall) packages
Shawn Walker <shawn.walker@oracle.com>
parents:
2073
diff
changeset
|
1701 |
version of OpenSolaris. Please update without the --be-name option.""") |
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
|
1702 |
|
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
|
1703 |
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
|
1704 |
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
|
1705 |
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
|
1706 |
|
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
|
1707 |
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
|
1708 |
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
|
1709 |
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
|
1710 |
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
|
1711 |
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
|
1712 |
|
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
|
1713 |
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
|
1714 |
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
|
1715 |
"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
|
1716 |
"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
|
1717 |
} |
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
|
1718 |
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
|
1719 |
A problem occurred while attempting to rename the boot environment |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1720 |
currently named {orig} to {dest}.""").format(**d) |
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
|
1721 |
|
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
|
1722 |
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
|
1723 |
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
|
1724 |
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
|
1725 |
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
|
1726 |
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
|
1727 |
|
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
|
1728 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1729 |
return _("Unable to mount {name} at {mt}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1730 |
name=self.name, mt=self.mountpoint) |
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
|
1731 |
|
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
|
1732 |
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
|
1733 |
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
|
1734 |
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
|
1735 |
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
|
1736 |
|
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
|
1737 |
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
|
1738 |
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
|
1739 |
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
|
1740 |
not allowed.""") |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1741 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1742 |
|
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
|
1743 |
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
|
1744 |
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
|
1745 |
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
|
1746 |
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
|
1747 |
|
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
|
1748 |
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
|
1749 |
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
|
1750 |
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
|
1751 |
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
|
1752 |
return s |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1753 |
|
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1754 |
class IncorrectIndexFileHash(ApiException): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1755 |
"""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
|
1756 |
packages installed in the image.""" |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1757 |
pass |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1758 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
1759 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1760 |
class PublisherError(ApiException): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1761 |
"""Base exception class for all publisher exceptions.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1762 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1763 |
def __init__(self, *args, **kwargs): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1764 |
ApiException.__init__(self, *args) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1765 |
if args: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1766 |
self.data = args[0] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1767 |
else: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1768 |
self.data = None |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
1769 |
self._args = kwargs |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1770 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1771 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1772 |
return str(self.data) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1773 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1774 |
|
1087
293c0aa5f32e
8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents:
1076
diff
changeset
|
1775 |
class BadPublisherMetaRoot(PublisherError): |
293c0aa5f32e
8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents:
1076
diff
changeset
|
1776 |
"""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
|
1777 |
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
|
1778 |
|
293c0aa5f32e
8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents:
1076
diff
changeset
|
1779 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1780 |
return _("Publisher meta_root '{root}' is invalid; unable " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1781 |
"to complete operation: '{op}'.").format(root=self.data, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1782 |
op=self._args.get("operation", None)) |
1087
293c0aa5f32e
8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents:
1076
diff
changeset
|
1783 |
|
293c0aa5f32e
8214 load_catalogs should only load catalog data when needed
Shawn Walker <srw@sun.com>
parents:
1076
diff
changeset
|
1784 |
|
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1785 |
class BadPublisherAlias(PublisherError): |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1786 |
"""Used to indicate that a publisher alias is not valid.""" |
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1787 |
|
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1788 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1789 |
return _("'{0}' is not a valid publisher alias.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1790 |
self.data) |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1791 |
|
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
1792 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1793 |
class BadPublisherPrefix(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1794 |
"""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
|
1795 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1796 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1797 |
return _("'{0}' is not a valid publisher name.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1798 |
self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1799 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1800 |
|
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
1801 |
class ReservedPublisherPrefix(PublisherError): |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
1802 |
"""Used to indicate that a publisher name is not valid.""" |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
1803 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
1804 |
def __str__(self): |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
1805 |
fmri = self._args["fmri"] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1806 |
return _("'{pkg_pub}' is a reserved publisher and does not " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1807 |
"contain the requested package: pkg:/{pkg_name}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1808 |
pkg_pub=fmri.publisher, pkg_name=fmri.pkg_name) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
1809 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
1810 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1811 |
class BadRepositoryAttributeValue(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1812 |
"""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
|
1813 |
invalid.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1814 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1815 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1816 |
return _("'{value}' is not a valid value for repository " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1817 |
"attribute '{attribute}'.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1818 |
value=self._args["value"], attribute=self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1819 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1820 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1821 |
class BadRepositoryCollectionType(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1822 |
"""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
|
1823 |
invalid.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1824 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1825 |
def __init__(self, *args, **kwargs): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1826 |
PublisherError.__init__(self, *args, **kwargs) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1827 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1828 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1829 |
return _("'{0}' is not a valid repository collection type.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1830 |
self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1831 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1832 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1833 |
class BadRepositoryURI(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1834 |
"""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
|
1835 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1836 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1837 |
return _("'{0}' is not a valid URI.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1838 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1839 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1840 |
class BadRepositoryURIPriority(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1841 |
"""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
|
1842 |
not valid.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1843 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1844 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1845 |
return _("'{0}' is not a valid URI priority; integer value " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1846 |
"expected.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1847 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1848 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1849 |
class BadRepositoryURISortPolicy(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1850 |
"""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
|
1851 |
invalid.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1852 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1853 |
def __init__(self, *args, **kwargs): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1854 |
PublisherError.__init__(self, *args, **kwargs) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1855 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1856 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1857 |
return _("'{0}' is not a valid repository URI sort policy.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1858 |
self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1859 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1860 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1861 |
class DisabledPublisher(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1862 |
"""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
|
1863 |
during an operation.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1864 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1865 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1866 |
return _("Publisher '{0}' is disabled and cannot be used for " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1867 |
"packaging operations.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1868 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1869 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1870 |
class DuplicatePublisher(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1871 |
"""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
|
1872 |
exists for an image.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1873 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1874 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1875 |
return _("A publisher with the same name or alias as '{0}' " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1876 |
"already exists.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1877 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1878 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1879 |
class DuplicateRepository(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1880 |
"""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
|
1881 |
already exists for a publisher.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1882 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1883 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1884 |
return _("A repository with the same name or origin URIs " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1885 |
"already exists for publisher '{0}'.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1886 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1887 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1888 |
class DuplicateRepositoryMirror(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1889 |
"""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
|
1890 |
repository mirror.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1891 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1892 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1893 |
return _("Mirror '{0}' already exists for the specified " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1894 |
"publisher.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1895 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1896 |
|
2701
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1897 |
class DuplicateSyspubMirror(PublisherError): |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1898 |
"""Used to indicate that a repository URI is already in use by the |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1899 |
system publisher.""" |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1900 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1901 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1902 |
return _("Mirror '{0}' is already accessible through the " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1903 |
"system repository.").format(self.data) |
2701
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1904 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1905 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1906 |
class DuplicateRepositoryOrigin(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1907 |
"""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
|
1908 |
repository origin.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1909 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1910 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1911 |
return _("Origin '{0}' already exists for the specified " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1912 |
"publisher.").format(self.data) |
1504
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1461
diff
changeset
|
1913 |
|
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1461
diff
changeset
|
1914 |
|
2701
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1915 |
class DuplicateSyspubOrigin(PublisherError): |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1916 |
"""Used to indicate that a repository URI is already in use by the |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1917 |
system publisher.""" |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1918 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1919 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1920 |
return _("Origin '{0}' is already accessible through the " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1921 |
"system repository.").format(self.data) |
2701
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1922 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1923 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1924 |
class RemoveSyspubOrigin(PublisherError): |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1925 |
"""Used to indicate that a system publisher origin may not be |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1926 |
removed.""" |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1927 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1928 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1929 |
return _("Unable to remove origin '{0}' since it is provided " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1930 |
"by the system repository.").format(self.data) |
2701
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1931 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1932 |
class RemoveSyspubMirror(PublisherError): |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1933 |
"""Used to indicate that a system publisher mirror may not be |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1934 |
removed.""" |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1935 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1936 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1937 |
return _("Unable to remove mirror '{0}' since it is provided " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1938 |
"by the system repository.").format(self.data) |
2701
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1939 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
1940 |
|
2322
06de944cbceb
18193 transport can traceback for packages that belong to a publisher not in configuration
Shawn Walker <shawn.walker@oracle.com>
parents:
2316
diff
changeset
|
1941 |
class NoPublisherRepositories(TransportError): |
2219
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2215
diff
changeset
|
1942 |
"""Used to indicate that a Publisher has no repository information |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2215
diff
changeset
|
1943 |
configured and so transport operations cannot be performed.""" |
1504
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1461
diff
changeset
|
1944 |
|
2322
06de944cbceb
18193 transport can traceback for packages that belong to a publisher not in configuration
Shawn Walker <shawn.walker@oracle.com>
parents:
2316
diff
changeset
|
1945 |
def __init__(self, prefix): |
06de944cbceb
18193 transport can traceback for packages that belong to a publisher not in configuration
Shawn Walker <shawn.walker@oracle.com>
parents:
2316
diff
changeset
|
1946 |
TransportError.__init__(self) |
06de944cbceb
18193 transport can traceback for packages that belong to a publisher not in configuration
Shawn Walker <shawn.walker@oracle.com>
parents:
2316
diff
changeset
|
1947 |
self.publisher = prefix |
06de944cbceb
18193 transport can traceback for packages that belong to a publisher not in configuration
Shawn Walker <shawn.walker@oracle.com>
parents:
2316
diff
changeset
|
1948 |
|
1504
265a1d6b86bd
9969 client support for multiple origins desired
Shawn Walker <srw@sun.com>
parents:
1461
diff
changeset
|
1949 |
def __str__(self): |
3167
0ba404e884a4
15586205 pkg needs solution-oriented error if user removes publisher repos
Shawn Walker <shawn.walker@oracle.com>
parents:
3158
diff
changeset
|
1950 |
return _(""" |
0ba404e884a4
15586205 pkg needs solution-oriented error if user removes publisher repos
Shawn Walker <shawn.walker@oracle.com>
parents:
3158
diff
changeset
|
1951 |
The requested operation requires that one or more package repositories are |
0ba404e884a4
15586205 pkg needs solution-oriented error if user removes publisher repos
Shawn Walker <shawn.walker@oracle.com>
parents:
3158
diff
changeset
|
1952 |
configured for publisher '{0}'. |
0ba404e884a4
15586205 pkg needs solution-oriented error if user removes publisher repos
Shawn Walker <shawn.walker@oracle.com>
parents:
3158
diff
changeset
|
1953 |
|
0ba404e884a4
15586205 pkg needs solution-oriented error if user removes publisher repos
Shawn Walker <shawn.walker@oracle.com>
parents:
3158
diff
changeset
|
1954 |
Use 'pkg set-publisher' to add new package repositories or restore previously |
0ba404e884a4
15586205 pkg needs solution-oriented error if user removes publisher repos
Shawn Walker <shawn.walker@oracle.com>
parents:
3158
diff
changeset
|
1955 |
configured package repositories for publisher '{0}'.""").format(self.publisher) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1956 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1957 |
|
1505
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
1958 |
class MoveRelativeToSelf(PublisherError): |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
1959 |
"""Used to indicate an attempt to search a repo before or after itself""" |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
1960 |
|
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
1961 |
def __str__(self): |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
1962 |
return _("Cannot search a repository before or after itself") |
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
1963 |
|
cc598d70bbbe
4425 pkg install should deal w/ complex dependency changes in one install
Bart Smaalders <Bart.Smaalders@Sun.COM>
parents:
1504
diff
changeset
|
1964 |
|
2409
af05aaca7093
18525 pkg set-publisher dies on invalid --search-before values
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2407
diff
changeset
|
1965 |
class MoveRelativeToUnknown(PublisherError): |
af05aaca7093
18525 pkg set-publisher dies on invalid --search-before values
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2407
diff
changeset
|
1966 |
"""Used to indicate an attempt to order a publisher relative to an |
af05aaca7093
18525 pkg set-publisher dies on invalid --search-before values
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2407
diff
changeset
|
1967 |
unknown publisher.""" |
af05aaca7093
18525 pkg set-publisher dies on invalid --search-before values
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2407
diff
changeset
|
1968 |
|
af05aaca7093
18525 pkg set-publisher dies on invalid --search-before values
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2407
diff
changeset
|
1969 |
def __init__(self, unknown_pub): |
af05aaca7093
18525 pkg set-publisher dies on invalid --search-before values
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2407
diff
changeset
|
1970 |
self.__unknown_pub = unknown_pub |
af05aaca7093
18525 pkg set-publisher dies on invalid --search-before values
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2407
diff
changeset
|
1971 |
|
af05aaca7093
18525 pkg set-publisher dies on invalid --search-before values
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2407
diff
changeset
|
1972 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1973 |
return _("{0} is an unknown publisher; no other publishers can " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1974 |
"be ordered relative to it.").format(self.__unknown_pub) |
2409
af05aaca7093
18525 pkg set-publisher dies on invalid --search-before values
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2407
diff
changeset
|
1975 |
|
af05aaca7093
18525 pkg set-publisher dies on invalid --search-before values
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2407
diff
changeset
|
1976 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1977 |
class SelectedRepositoryRemoval(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1978 |
"""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
|
1979 |
for a publisher was made.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1980 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1981 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1982 |
return _("Cannot remove the selected repository for a " |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1983 |
"publisher.") |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1984 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1985 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1986 |
class UnknownLegalURI(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1987 |
"""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
|
1988 |
provided criteria.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1989 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1990 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1991 |
return _("Unknown legal URI '{0}'.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1992 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1993 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1994 |
class UnknownPublisher(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1995 |
"""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
|
1996 |
provided criteria.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1997 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
1998 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
1999 |
return _("Unknown publisher '{0}'.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2000 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2001 |
|
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2002 |
class UnknownRepositoryPublishers(PublisherError): |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2003 |
"""Used to indicate that one or more publisher prefixes are unknown by |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2004 |
the specified repository.""" |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2005 |
|
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2006 |
def __init__(self, known=EmptyI, unknown=EmptyI, location=None, |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2007 |
origins=EmptyI): |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2008 |
ApiException.__init__(self) |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2009 |
self.known = known |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2010 |
self.location = location |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2011 |
self.origins = origins |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2012 |
self.unknown = unknown |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2013 |
|
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2014 |
def __str__(self): |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2015 |
if self.location: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2016 |
return _("The repository at {location} does not " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2017 |
"contain package data for {unknown}; only " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2018 |
"{known}.\n\nThis is either because the " |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2019 |
"repository location is not valid, or because the " |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2020 |
"provided publisher does not match those known by " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2021 |
"the repository.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2022 |
unknown=", ".join(self.unknown), |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2023 |
location=self.location, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2024 |
known=", ".join(self.known)) |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2025 |
if self.origins: |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2026 |
return _("One or more of the repository origin(s) " |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2027 |
"listed below contains package data for " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2028 |
"{known}; not {unknown}:\n\n{origins}\n\n" |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2029 |
"This is either because one of the repository " |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2030 |
"origins is not valid for this publisher, or " |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2031 |
"because the list of known publishers retrieved " |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2032 |
"from the repository origin does not match the " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2033 |
"client.").format(unknown=", ".join(self.unknown), |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2034 |
known=", ".join(self.known), |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2035 |
origins="\n".join(str(o) for o in self.origins)) |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2036 |
return _("The specified publisher repository does not " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2037 |
"contain any package data for {unknown}; only " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2038 |
"{known}.").format(unknown=", ".join(self.unknown), |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2039 |
known=", ".join(self.known)) |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2040 |
|
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2041 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2042 |
class UnknownRelatedURI(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2043 |
"""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
|
2044 |
the provided criteria.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2045 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2046 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2047 |
return _("Unknown related URI '{0}'.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2048 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2049 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2050 |
class UnknownRepository(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2051 |
"""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
|
2052 |
provided criteria.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2053 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2054 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2055 |
return _("Unknown repository '{0}'.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2056 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2057 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2058 |
class UnknownRepositoryMirror(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2059 |
"""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
|
2060 |
list of repository mirrors.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2061 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2062 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2063 |
return _("Unknown repository mirror '{0}'.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2064 |
|
2316
9eb53e68d674
17741 pkgrecv should allow wildcards in package versions
Shawn Walker <shawn.walker@oracle.com>
parents:
2310
diff
changeset
|
2065 |
class UnsupportedRepositoryOperation(TransportError): |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
2066 |
"""The publisher has no active repositories that support the |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
2067 |
requested operation.""" |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
2068 |
|
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
2069 |
def __init__(self, pub, operation): |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
2070 |
ApiException.__init__(self) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
2071 |
self.data = None |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
2072 |
self.kwargs = None |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
2073 |
self.pub = pub |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
2074 |
self.op = operation |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
2075 |
|
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1372
diff
changeset
|
2076 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2077 |
return _("Publisher '{pub}' has no repositories that support " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2078 |
"the '{op}' operation.").format(**self.__dict__) |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2079 |
|
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2080 |
|
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2081 |
class RepoPubConfigUnavailable(PublisherError): |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2082 |
"""Used to indicate that the specified repository does not provide |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2083 |
publisher configuration information.""" |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2084 |
|
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2085 |
def __init__(self, location=None, pub=None): |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2086 |
ApiException.__init__(self) |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2087 |
self.location = location |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2088 |
self.pub = pub |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2089 |
|
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2090 |
def __str__(self): |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2091 |
if not self.location and not self.pub: |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2092 |
return _("The specified package repository does not " |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2093 |
"provide publisher configuration information.") |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2094 |
if self.location: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2095 |
return _("The package repository at {0} does not " |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2096 |
"provide publisher configuration information or " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2097 |
"the information provided is incomplete.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2098 |
self.location) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2099 |
return _("One of the package repository origins for {0} does " |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2100 |
"not provide publisher configuration information or the " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2101 |
"information provided is incomplete.").format(self.pub) |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2102 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2103 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2104 |
class UnknownRepositoryOrigin(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2105 |
"""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
|
2106 |
list of repository origins.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2107 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2108 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2109 |
return _("Unknown repository origin '{0}'").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2110 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2111 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2112 |
class UnsupportedRepositoryURI(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2113 |
"""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
|
2114 |
unsupported scheme.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2115 |
|
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2116 |
def __init__(self, uris=[]): |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3206
diff
changeset
|
2117 |
if isinstance(uris, six.string_types): |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2118 |
uris = [uris] |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2119 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2120 |
assert isinstance(uris, (list, tuple, set)) |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2121 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2122 |
self.uris = uris |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2123 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2124 |
def __str__(self): |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2125 |
illegals = [] |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2126 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2127 |
for u in self.uris: |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3206
diff
changeset
|
2128 |
assert isinstance(u, six.string_types) |
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3206
diff
changeset
|
2129 |
scheme = urlsplit(u, |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2130 |
allow_fragments=0)[0] |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2131 |
illegals.append((u, scheme)) |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2132 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2133 |
if len(illegals) > 1: |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2134 |
msg = _("The follwing URIs use unsupported " |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2135 |
"schemes. Supported schemes are " |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2136 |
"file://, http://, and https://.") |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2137 |
for i, s in illegals: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2138 |
msg += _("\n {uri} (scheme: " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2139 |
"{scheme})").format(uri=i, scheme=s) |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2140 |
return msg |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2141 |
elif len(illegals) == 1: |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2142 |
i, s = illegals[0] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2143 |
return _("The URI '{uri}' uses the unsupported " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2144 |
"scheme '{scheme}'. Supported schemes are " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2145 |
"file://, http://, and https://.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2146 |
uri=i, scheme=s) |
2144
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2147 |
return _("The specified URI uses an unsupported scheme." |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
2148 |
" Supported schemes are: file://, http://, and " |
2840
2f6f88362fd1
15981296 pkg API should have basic input checking for clients other than the CLI (2)
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2839
diff
changeset
|
2149 |
"https://.") |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2150 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2151 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2152 |
class UnsupportedRepositoryURIAttribute(PublisherError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2153 |
"""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
|
2154 |
supported for the URI's scheme.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2155 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2156 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2157 |
return _("'{attr}' is not supported for '{scheme}'.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2158 |
attr=self.data, scheme=self._args["scheme"]) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2159 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2160 |
|
2701
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2161 |
class UnsupportedProxyURI(PublisherError): |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2162 |
"""Used to indicate that the specified proxy URI is unsupported.""" |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2163 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2164 |
def __str__(self): |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2165 |
if self.data: |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3206
diff
changeset
|
2166 |
scheme = urlsplit(self.data, |
2701
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2167 |
allow_fragments=0)[0] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2168 |
return _("The proxy URI '{uri}' uses the unsupported " |
3244
e4c750222023
15885237 transport fails with a confusing error when https proxy is used
sowrabha.hg@oracle.com
parents:
3234
diff
changeset
|
2169 |
"scheme '{scheme}'. Currently the only supported " |
e4c750222023
15885237 transport fails with a confusing error when https proxy is used
sowrabha.hg@oracle.com
parents:
3234
diff
changeset
|
2170 |
"scheme is http://.").format( |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2171 |
uri=self.data, scheme=scheme) |
2701
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2172 |
return _("The specified proxy URI uses an unsupported scheme." |
3244
e4c750222023
15885237 transport fails with a confusing error when https proxy is used
sowrabha.hg@oracle.com
parents:
3234
diff
changeset
|
2173 |
" Currently the only supported scheme is: http://.") |
2701
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2174 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2175 |
class BadProxyURI(PublisherError): |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2176 |
"""Used to indicate that a proxy URI is not syntactically valid.""" |
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2177 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2178 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2179 |
return _("'{0}' is not a valid URI.").format(self.data) |
2701
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2180 |
|
55bf0cb749ae
7136244 granular configuration of http_proxy option
Tim Foster <tim.s.foster@oracle.com>
parents:
2690
diff
changeset
|
2181 |
|
2310
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2182 |
class UnknownSysrepoConfiguration(ApiException): |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2183 |
"""Used when a pkg client needs to communicate with the system |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2184 |
repository but can't find the configuration for it.""" |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2185 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2186 |
def __str__(self): |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2187 |
return _("""\ |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2188 |
pkg is configured to use the system repository (via the use-system-repo |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2189 |
property) but it could not get the host and port from |
2367
49e71b6682c7
18297 system-repository needs to be enabled more
Tim Foster <tim.s.foster@oracle.com>
parents:
2364
diff
changeset
|
2190 |
svc:/application/pkg/zones-proxy-client nor svc:/application/pkg/system-repository, and |
2335
33734ca16f74
18254 system repository package should be renamed
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2322
diff
changeset
|
2191 |
the PKG_SYSREPO_URL environment variable was not set. Please try enabling one |
33734ca16f74
18254 system repository package should be renamed
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2322
diff
changeset
|
2192 |
of those services or setting the PKG_SYSREPO_URL environment variable. |
2310
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2193 |
""") |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2194 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2195 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2196 |
class ModifyingSyspubException(ApiException): |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2197 |
"""This exception is raised when a user attempts to modify a system |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2198 |
publisher.""" |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2199 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2200 |
def __init__(self, s): |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2201 |
self.s = s |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2202 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2203 |
def __str__(self): |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2204 |
return self.s |
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2205 |
|
ce10607d5332
11684 desire option to not propagate certs to non-global zones
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2301
diff
changeset
|
2206 |
|
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2207 |
class SigningException(ApiException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2208 |
"""The base class for exceptions related to manifest signing.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2209 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2210 |
def __init__(self, pfmri=None, sig=None): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2211 |
self.pfmri = pfmri |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2212 |
self.sig = sig |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2213 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2214 |
# This string method is used by subclasses to fill in the details |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2215 |
# about the package and signature involved. |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2216 |
def __str__(self): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2217 |
if self.pfmri: |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2218 |
if self.sig: |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2219 |
return _("The relevant signature action is " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2220 |
"found in {pfmri} and has a hash of " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2221 |
"{hsh}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2222 |
pfmri=self.pfmri, hsh=self.sig.hash) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2223 |
return _("The package involved is {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2224 |
self.pfmri) |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2225 |
if self.sig: |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2226 |
return _("The relevant signature action's value " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2227 |
"attribute is {0}").format(self.sig.attrs["value"]) |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2228 |
return "" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2229 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2230 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2231 |
class BadFileFormat(SigningException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2232 |
"""Exception used when a key, certificate or CRL file is not in a |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2233 |
recognized format.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2234 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2235 |
def __init__(self, txt): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2236 |
self.txt = txt |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2237 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2238 |
def __str__(self): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2239 |
return self.txt |
2200
155eda704b2f
16279 Need a way to revert certain editable files to a as-installed state
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2197
diff
changeset
|
2240 |
|
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2241 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2242 |
class UnsupportedSignatureVersion(SigningException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2243 |
"""Exception used when a signature reports a version which this version |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2244 |
of pkg(5) doesn't support.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2245 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2246 |
def __init__(self, version, *args, **kwargs): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2247 |
SigningException.__init__(self, *args, **kwargs) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2248 |
self.version = version |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2249 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2250 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2251 |
return _("The signature action {act} was made using a " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2252 |
"version ({ver}) this version of pkg(5) doesn't " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2253 |
"understand.").format(act=self.sig, ver=self.version) |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2254 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2255 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2256 |
class CertificateException(SigningException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2257 |
"""Base class for exceptions encountered while establishing the chain |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2258 |
of trust.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2259 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2260 |
def __init__(self, cert, pfmri=None): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2261 |
SigningException.__init__(self, pfmri) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2262 |
self.cert = cert |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2263 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2264 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2265 |
class ModifiedCertificateException(CertificateException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2266 |
"""Exception used when a certificate does not match its expected hash |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2267 |
value.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2268 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2269 |
def __init__(self, cert, path, pfmri=None): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2270 |
CertificateException.__init__(self, cert, pfmri) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2271 |
self.path = path |
2200
155eda704b2f
16279 Need a way to revert certain editable files to a as-installed state
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2197
diff
changeset
|
2272 |
|
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2273 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2274 |
return _("Certificate {0} has been modified on disk. Its hash " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2275 |
"value is not what was expected.").format(self.path) |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2276 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2277 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2278 |
class UntrustedSelfSignedCert(CertificateException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2279 |
"""Exception used when a chain of trust is rooted in an untrusted |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2280 |
self-signed certificate.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2281 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2282 |
def __str__(self): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2283 |
return _("Chain was rooted in an untrusted self-signed " |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2284 |
"certificate.\n") + CertificateException.__str__(self) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2285 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2286 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2287 |
class BrokenChain(CertificateException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2288 |
"""Exception used when a chain of trust can not be established between |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2289 |
the leaf certificate and a trust anchor.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2290 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2291 |
def __init__(self, cert, cert_exceptions, *args, **kwargs): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2292 |
CertificateException.__init__(self, cert, *args, **kwargs) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2293 |
self.ext_exs = cert_exceptions |
2200
155eda704b2f
16279 Need a way to revert certain editable files to a as-installed state
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2197
diff
changeset
|
2294 |
|
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2295 |
def __str__(self): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2296 |
s = "" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2297 |
if self.ext_exs: |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2298 |
s = _("The following problems were encountered:\n") + \ |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2299 |
"\n".join([str(e) for e in self.ext_exs]) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2300 |
return _("The certificate which issued this " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2301 |
"certificate: {subj} could not be found. The issuer " |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2302 |
"is: {issuer}\n").format(subj="/".join("{0}={1}".format( |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2303 |
sub.oid._name, sub.value) for sub in self.cert.subject), |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2304 |
issuer="/".join("{0}={1}".format(i.oid._name, i.value) |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2305 |
for i in self.cert.issuer)) + s + "\n" + \ |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2306 |
CertificateException.__str__(self) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2307 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2308 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2309 |
class RevokedCertificate(CertificateException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2310 |
"""Exception used when a chain of trust contains a revoked certificate. |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2311 |
""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2312 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2313 |
def __init__(self, cert, reason, *args, **kwargs): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2314 |
CertificateException.__init__(self, cert, *args, **kwargs) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2315 |
self.reason = reason |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2316 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2317 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2318 |
return _("This certificate was revoked:{cert} for this " |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2319 |
"reason:\n{reason}\n").format(cert="/".join("{0}={1}".format( |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2320 |
s.oid._name, s.value) for s in self.cert.subject), |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2321 |
reason=self.reason) + CertificateException.__str__(self) |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2322 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2323 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2324 |
class UnverifiedSignature(SigningException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2325 |
"""Exception used when a signature could not be verified by the |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2326 |
expected certificate.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2327 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2328 |
def __init__(self, sig, reason, pfmri=None): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2329 |
SigningException.__init__(self, pfmri) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2330 |
self.sig = sig |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2331 |
self.reason = reason |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2332 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2333 |
def __str__(self): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2334 |
if self.pfmri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2335 |
return _("A signature in {pfmri} could not be " |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2336 |
"verified for " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2337 |
"this reason:\n{reason}\nThe signature's hash is " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2338 |
"{hash}").format(pfmri=self.pfmri, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2339 |
reason=self.reason, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2340 |
hash=self.sig.hash) |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2341 |
return _("The signature with this signature value:\n" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2342 |
"{sigval}\n could not be verified for this reason:\n" |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2343 |
"{reason}\n").format(reason=self.reason, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2344 |
sigval=self.sig.attrs["value"]) |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2345 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2346 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2347 |
class RequiredSignaturePolicyException(SigningException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2348 |
"""Exception used when signatures were required but none were found.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2349 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2350 |
def __init__(self, pub, pfmri=None): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2351 |
SigningException.__init__(self, pfmri) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2352 |
self.pub = pub |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2353 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2354 |
def __str__(self): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2355 |
pub_str = self.pub.prefix |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2356 |
if self.pfmri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2357 |
return _("The policy for {pub_str} requires " |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2358 |
"signatures to be present but no signature was " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2359 |
"found in {fmri_str}.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2360 |
pub_str=pub_str, fmri_str=self.pfmri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2361 |
return _("The policy for {pub_str} requires signatures to be " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2362 |
"present but no signature was found.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2363 |
pub_str=pub_str) |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2364 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2365 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2366 |
class MissingRequiredNamesException(SigningException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2367 |
"""Exception used when a signature policy required names to be seen |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2368 |
which weren't seen.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2369 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2370 |
def __init__(self, pub, missing_names, pfmri=None): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2371 |
SigningException.__init__(self, pfmri) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2372 |
self.pub = pub |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2373 |
self.missing_names = missing_names |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2374 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2375 |
def __str__(self): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2376 |
pub_str = self.pub.prefix |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2377 |
if self.pfmri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2378 |
return _("The policy for {pub_str} requires certain " |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2379 |
"CNs to be seen in a chain of trust. The following " |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2380 |
"required names couldn't be found for this " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2381 |
"package:{fmri_str}.\n{missing}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2382 |
pub_str=pub_str, fmri_str=self.pfmri, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2383 |
missing="\n".join(self.missing_names)) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2384 |
return _("The policy for {pub_str} requires certain CNs to " |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2385 |
"be seen in a chain of trust. The following required names " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2386 |
"couldn't be found.\n{missing}").format(pub_str=pub_str, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2387 |
missing="\n".join(self.missing_names)) |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2388 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2389 |
class UnsupportedCriticalExtension(SigningException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2390 |
"""Exception used when a certificate in the chain of trust uses a |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2391 |
critical extension pkg doesn't understand.""" |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2392 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2393 |
def __init__(self, cert, ext): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2394 |
SigningException.__init__(self) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2395 |
self.cert = cert |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2396 |
self.ext = ext |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2397 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2398 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2399 |
return _("The certificate whose subject is {cert} could not " |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2400 |
"be verified because it uses an unsupported critical " |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2401 |
"extension.\nExtension name: {name}\nExtension " |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2402 |
"value: {val}").format(cert="/".join("{0}={1}".format( |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2403 |
s.oid._name, s.value) for s in self.cert.subject), |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2404 |
name=self.ext.oid._name, val=self.ext.value) |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2405 |
|
2215
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2406 |
class UnsupportedExtensionValue(SigningException): |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2407 |
"""Exception used when a certificate in the chain of trust has an |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2408 |
extension with a value pkg doesn't understand.""" |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2409 |
|
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2410 |
def __init__(self, cert, ext, val, bad_val=None): |
2215
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2411 |
SigningException.__init__(self) |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2412 |
self.cert = cert |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2413 |
self.ext = ext |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2414 |
self.val = val |
2215
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2415 |
self.bad_val = bad_val |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2416 |
|
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2417 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2418 |
s = _("The certificate whose subject is {cert} could not be " |
2215
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2419 |
"verified because it has an extension with a value that " |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2420 |
"pkg(5) does not understand." |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2421 |
"\nExtension name: {name}\nExtension value: {val}").format( |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2422 |
cert="/".join("{0}={1}".format( |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2423 |
s.oid._name, s.value) for s in self.cert.subject), |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2424 |
name=self.ext.oid._name, val=self.val) |
2215
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2425 |
if self.bad_val: |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2426 |
s += _("\nProblematic value: {0}").format(self.bad_val) |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2427 |
return s |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2428 |
|
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2429 |
class InvalidCertificateExtensions(SigningException): |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2430 |
"""Exception used when a certificate in the chain of trust has |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2431 |
invalid extensions.""" |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2432 |
|
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2433 |
def __init__(self, cert, error): |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2434 |
SigningException.__init__(self) |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2435 |
self.cert = cert |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2436 |
self.error = error |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2437 |
|
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2438 |
def __str__(self): |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2439 |
s = _("The certificate whose subject is {cert} could not be " |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2440 |
"verified because it has invalid extensions:\n{error}" |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2441 |
).format(cert="/".join("{0}={1}".format( |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2442 |
s.oid._name, s.value) for s in self.cert.subject), |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2443 |
error=self.error) |
2215
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2444 |
return s |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2445 |
|
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2446 |
class InappropriateCertificateUse(SigningException): |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2447 |
"""Exception used when a certificate in the chain of trust has been used |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2448 |
inappropriately. An example would be a certificate which was only |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2449 |
supposed to be used to sign code being used to sign other certificates. |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2450 |
""" |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2451 |
|
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2452 |
def __init__(self, cert, ext, use, val): |
2215
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2453 |
SigningException.__init__(self) |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2454 |
self.cert = cert |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2455 |
self.ext = ext |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2456 |
self.use = use |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2457 |
self.val = val |
2215
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2458 |
|
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2459 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2460 |
return _("The certificate whose subject is {cert} could not " |
2215
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2461 |
"be verified because it has been used inappropriately. " |
b4355e8c5097
16856 need to check keyUsage for leaf certs
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2212
diff
changeset
|
2462 |
"The way it is used means that the value for extension " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2463 |
"{name} must include '{use}' but the value was " |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2464 |
"'{val}'.").format(cert="/".join("{0}={1}".format( |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2465 |
s.oid._name, s.value) for s in self.cert.subject), |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2466 |
use=self.use, name=self.ext.oid._name, |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2467 |
val=self.val) |
2286
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2468 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2469 |
class PathlenTooShort(InappropriateCertificateUse): |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2470 |
"""Exception used when a certificate in the chain of trust has been used |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2471 |
inappropriately. An example would be a certificate which was only |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2472 |
supposed to be used to sign code being used to sign other certificates. |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2473 |
""" |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2474 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2475 |
def __init__(self, cert, actual_length, cert_length): |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2476 |
SigningException.__init__(self) |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2477 |
self.cert = cert |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2478 |
self.al = actual_length |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2479 |
self.cl = cert_length |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2480 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2481 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2482 |
return _("The certificate whose subject is {cert} could not " |
2286
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2483 |
"be verified because it has been used inappropriately. " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2484 |
"There can only be {cl} certificates between this " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2485 |
"certificate and the leaf certificate. There are {al} " |
2286
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2486 |
"certificates between this certificate and the leaf in " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2487 |
"this chain.").format( |
3321
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2488 |
cert="/".join("{0}={1}".format( |
52e8eec3014c
17377205 IPS should not use M2Crypto
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3293
diff
changeset
|
2489 |
s.oid._name, s.value) for s in self.cert.subject), |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2490 |
al=self.al, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2491 |
cl=self.cl |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2492 |
) |
2286
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2493 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2494 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2495 |
class AlmostIdentical(ApiException): |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2496 |
"""Exception used when a package already has a signature action which is |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2497 |
nearly identical to the one being added but differs on some |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2498 |
attributes.""" |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2499 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2500 |
def __init__(self, hsh, algorithm, version, pkg=None): |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2501 |
self.hsh = hsh |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2502 |
self.algorithm = algorithm |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2503 |
self.version = version |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2504 |
self.pkg = pkg |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2505 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2506 |
def __str__(self): |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2507 |
s = _("The signature to be added to the package has the same " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2508 |
"hash ({hash}), algorithm ({algorithm}), and " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2509 |
"version ({version}) as an existing signature, but " |
2286
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2510 |
"doesn't match the signature exactly. For this signature " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2511 |
"to be added, the existing signature must be removed.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2512 |
hash=self.hsh, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2513 |
algorithm=self.algorithm, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2514 |
version=self.version |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2515 |
) |
2286
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2516 |
if self.pkg: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2517 |
s += _("The package being signed was {pkg}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2518 |
pkg=self.pkg) |
2286
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2519 |
return s |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2520 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2521 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2522 |
class DuplicateSignaturesAlreadyExist(ApiException): |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2523 |
"""Exception used when a package already has a signature action which is |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2524 |
nearly identical to the one being added but differs on some |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2525 |
attributes.""" |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2526 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2527 |
def __init__(self, pfmri): |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2528 |
self.pfmri = pfmri |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2529 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2530 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2531 |
return _("{0} could not be signed because it already has two " |
2286
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2532 |
"copies of this signature in it. One of those signature " |
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2533 |
"actions must be removed before the package is given to " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2534 |
"users.").format(self.pfmri) |
2286
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2535 |
|
938fbb350ad2
16867 pkgsign should handle existing signatures better
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2239
diff
changeset
|
2536 |
|
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2537 |
class InvalidPropertyValue(ApiException): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2538 |
"""Exception used when a property was set to an invalid value.""" |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2539 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2540 |
def __init__(self, s): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2541 |
ApiException.__init__(self) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2542 |
self.str = s |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2543 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2544 |
def __str__(self): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2545 |
return self.str |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2546 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2547 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2548 |
class CertificateError(ApiException): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2549 |
"""Base exception class for all certificate exceptions.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2550 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2551 |
def __init__(self, *args, **kwargs): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2552 |
ApiException.__init__(self, *args) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2553 |
if args: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2554 |
self.data = args[0] |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2555 |
else: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2556 |
self.data = None |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2557 |
self._args = kwargs |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2558 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2559 |
def __str__(self): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2560 |
return str(self.data) |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2561 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2562 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2563 |
class ExpiredCertificate(CertificateError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2564 |
"""Used to indicate that a certificate has expired.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2565 |
|
2980
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2566 |
def __init__(self, *args, **kwargs): |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2567 |
CertificateError.__init__(self, *args, **kwargs) |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2568 |
self.publisher = self._args.get("publisher", None) |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2569 |
self.uri = self._args.get("uri", None) |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2570 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2571 |
def __str__(self): |
2980
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2572 |
if self.publisher: |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2573 |
if self.uri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2574 |
return _("Certificate '{cert}' for publisher " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2575 |
"'{pub}' needed to access '{uri}', " |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2576 |
"has expired. Please install a valid " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2577 |
"certificate.").format(cert=self.data, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2578 |
pub=self.publisher, uri=self.uri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2579 |
return _("Certificate '{cert}' for publisher " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2580 |
"'{pub}', has expired. Please install a valid " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2581 |
"certificate.").format(cert=self.data, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2582 |
pub=self.publisher) |
2980
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2583 |
if self.uri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2584 |
return _("Certificate '{cert}', needed to access " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2585 |
"'{uri}', has expired. Please install a valid " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2586 |
"certificate.").format(cert=self.data, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2587 |
uri=self.uri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2588 |
return _("Certificate '{0}' has expired. Please install a " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2589 |
"valid certificate.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2590 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2591 |
|
2980
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2592 |
class ExpiredCertificates(CertificateError): |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2593 |
"""Used to collect ExpiredCertficate exceptions.""" |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2594 |
|
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2595 |
def __init__(self, errors): |
3043
d0b8f7b429f3
18404810 linked image chokes on zonepaths which contain colons
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
3031
diff
changeset
|
2596 |
|
2980
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2597 |
self.errors = [] |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2598 |
|
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2599 |
assert (isinstance(errors, (list, tuple, |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2600 |
set, ExpiredCertificate))) |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2601 |
|
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2602 |
if isinstance(errors, ExpiredCertificate): |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2603 |
self.errors.append(errors) |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2604 |
else: |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2605 |
self.errors = errors |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2606 |
|
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2607 |
def __str__(self): |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2608 |
pdict = dict() |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2609 |
for e in self.errors: |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2610 |
if e.publisher in pdict: |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2611 |
pdict[e.publisher].append(e.uri) |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2612 |
else: |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2613 |
pdict[e.publisher] = [e.uri] |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2614 |
|
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2615 |
msg = "" |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2616 |
for pub, uris in pdict.items(): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2617 |
msg += "\n{0}:".format(_("Publisher")) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2618 |
msg += " {0}".format(pub) |
2980
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2619 |
for uri in uris: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2620 |
msg += "\n {0}:\n".format(_("Origin URI")) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2621 |
msg += " {0}\n".format(uri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2622 |
msg += " {0}:\n".format(_("Certificate")) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2623 |
msg += " {0}\n".format(uri.ssl_cert) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2624 |
msg += " {0}:\n".format(_("Key")) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2625 |
msg += " {0}\n".format(uri.ssl_key) |
2980
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2626 |
return _("One or more client key and certificate files have " |
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2627 |
"expired. Please\nupdate the configuration for the " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2628 |
"publishers or origins listed below:\n {0}").format(msg) |
2980
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2629 |
|
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
2630 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2631 |
class ExpiringCertificate(CertificateError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2632 |
"""Used to indicate that a certificate has expired.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2633 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2634 |
def __str__(self): |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2635 |
publisher = self._args.get("publisher", None) |
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2636 |
uri = self._args.get("uri", None) |
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2637 |
days = self._args.get("days", 0) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2638 |
if publisher: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2639 |
if uri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2640 |
return _("Certificate '{cert}' for publisher " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2641 |
"'{pub}', needed to access '{uri}', " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2642 |
"will expire in '{days}' days.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2643 |
cert=self.data, pub=publisher, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2644 |
uri=uri, days=days) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2645 |
return _("Certificate '{cert}' for publisher " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2646 |
"'{pub}' will expire in '{days}' days.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2647 |
cert=self.data, pub=publisher, days=days) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2648 |
if uri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2649 |
return _("Certificate '{cert}', needed to access " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2650 |
"'{uri}', will expire in '{days}' days.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2651 |
cert=self.data, uri=uri, days=days) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2652 |
return _("Certificate '{cert}' will expire in " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2653 |
"'{days}' days.").format(cert=self.data, days=days) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2654 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2655 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2656 |
class InvalidCertificate(CertificateError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2657 |
"""Used to indicate that a certificate is invalid.""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2658 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2659 |
def __str__(self): |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2660 |
publisher = self._args.get("publisher", None) |
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2661 |
uri = self._args.get("uri", None) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2662 |
if publisher: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2663 |
if uri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2664 |
return _("Certificate '{cert}' for publisher " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2665 |
"'{pub}', needed to access '{uri}', is " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2666 |
"invalid.").format(cert=self.data, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2667 |
pub=publisher, uri=uri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2668 |
return _("Certificate '{cert}' for publisher " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2669 |
"'{pub}' is invalid.").format(cert=self.data, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2670 |
pub=publisher) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2671 |
if uri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2672 |
return _("Certificate '{cert}' needed to access " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2673 |
"'{uri}' is invalid.").format(cert=self.data, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2674 |
uri=uri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2675 |
return _("Invalid certificate '{0}'.").format(self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2676 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2677 |
|
1254
28871b08d49c
8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents:
1191
diff
changeset
|
2678 |
class NoSuchKey(CertificateError): |
28871b08d49c
8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents:
1191
diff
changeset
|
2679 |
"""Used to indicate that a key could not be found.""" |
28871b08d49c
8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents:
1191
diff
changeset
|
2680 |
|
28871b08d49c
8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents:
1191
diff
changeset
|
2681 |
def __str__(self): |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2682 |
publisher = self._args.get("publisher", None) |
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2683 |
uri = self._args.get("uri", None) |
1254
28871b08d49c
8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents:
1191
diff
changeset
|
2684 |
if publisher: |
28871b08d49c
8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents:
1191
diff
changeset
|
2685 |
if uri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2686 |
return _("Unable to locate key '{key}' for " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2687 |
"publisher '{pub}' needed to access " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2688 |
"'{uri}'.").format(key=self.data, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2689 |
pub=publisher, uri=uri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2690 |
return _("Unable to locate key '{key}' for publisher " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2691 |
"'{pub}'.").format(key=self.data, pub=publisher |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2692 |
) |
1254
28871b08d49c
8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents:
1191
diff
changeset
|
2693 |
if uri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2694 |
return _("Unable to locate key '{key}' needed to " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2695 |
"access '{uri}'.").format(key=self.data, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2696 |
uri=uri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2697 |
return _("Unable to locate key '{0}'.").format(self.data) |
1254
28871b08d49c
8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents:
1191
diff
changeset
|
2698 |
|
28871b08d49c
8463 missing key file error message says certificate is missing
Shawn Walker <srw@sun.com>
parents:
1191
diff
changeset
|
2699 |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2700 |
class NoSuchCertificate(CertificateError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2701 |
"""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
|
2702 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2703 |
def __str__(self): |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2704 |
publisher = self._args.get("publisher", None) |
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2705 |
uri = self._args.get("uri", None) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2706 |
if publisher: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2707 |
if uri: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2708 |
return _("Unable to locate certificate " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2709 |
"'{cert}' for publisher '{pub}' needed " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2710 |
"to access '{uri}'.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2711 |
cert=self.data, pub=publisher, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2712 |
uri=uri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2713 |
return _("Unable to locate certificate '{cert}' for " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2714 |
"publisher '{pub}'.").format(cert=self.data, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2715 |
pub=publisher) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2716 |
if uri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2717 |
return _("Unable to locate certificate '{cert}' " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2718 |
"needed to access '{uri}'.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2719 |
cert=self.data, uri=uri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2720 |
return _("Unable to locate certificate '{0}'.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2721 |
self.data) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2722 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2723 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2724 |
class NotYetValidCertificate(CertificateError): |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2725 |
"""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
|
2726 |
effective date).""" |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2727 |
|
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2728 |
def __str__(self): |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2729 |
publisher = self._args.get("publisher", None) |
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2730 |
uri = self._args.get("uri", None) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2731 |
if publisher: |
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2732 |
if uri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2733 |
return _("Certificate '{cert}' for publisher " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2734 |
"'{pub}', needed to access '{uri}', " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2735 |
"has a future effective date.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2736 |
cert=self.data, pub=publisher, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2737 |
uri=uri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2738 |
return _("Certificate '{cert}' for publisher " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2739 |
"'{pub}' has a future effective date.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2740 |
cert=self.data, pub=publisher) |
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
922
diff
changeset
|
2741 |
if uri: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2742 |
return _("Certificate '{cert}' needed to access " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2743 |
"'{uri}' has a future effective date.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2744 |
cert=self.data, uri=uri) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2745 |
return _("Certificate '{0}' has a future effective date.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2746 |
self.data) |
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
2747 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
2748 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
2749 |
class ServerReturnError(ApiException): |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
2026
diff
changeset
|
2750 |
"""This exception is used when the server returns a line which the |
1100
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
2751 |
client cannot parse correctly.""" |
22a8b08d460a
7364 documentation and code comments needed for fix for 6175
Brock Pytlik <bpytlik@sun.com>
parents:
1087
diff
changeset
|
2752 |
|
941
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
2753 |
def __init__(self, line): |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
2754 |
ApiException.__init__(self) |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
2755 |
self.line = line |
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
2756 |
|
e7bff46da54e
6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
926
diff
changeset
|
2757 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2758 |
return _("Gave a bad response:{0}").format(self.line) |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1335
diff
changeset
|
2759 |
|
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2760 |
|
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1335
diff
changeset
|
2761 |
class MissingFileArgumentException(ApiException): |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1335
diff
changeset
|
2762 |
"""This exception is used when a file was given as an argument but |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1335
diff
changeset
|
2763 |
no such file could be found.""" |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1335
diff
changeset
|
2764 |
def __init__(self, path): |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1335
diff
changeset
|
2765 |
ApiException.__init__(self) |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1335
diff
changeset
|
2766 |
self.path = path |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1335
diff
changeset
|
2767 |
|
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1335
diff
changeset
|
2768 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2769 |
return _("Could not find {0}").format(self.path) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2770 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2771 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2772 |
class ManifestError(ApiException): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2773 |
"""Base exception class for all manifest exceptions.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2774 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2775 |
def __init__(self, *args, **kwargs): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2776 |
ApiException.__init__(self, *args, **kwargs) |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2777 |
if args: |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2778 |
self.data = args[0] |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2779 |
else: |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2780 |
self.data = None |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1505
diff
changeset
|
2781 |
self._args = kwargs |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2782 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2783 |
def __str__(self): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2784 |
return str(self.data) |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2785 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2786 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2787 |
class BadManifestSignatures(ManifestError): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2788 |
"""Used to indicate that the Manifest signatures are not valid.""" |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2789 |
|
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2790 |
def __str__(self): |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2791 |
if self.data: |
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2792 |
return _("The signature data for the manifest of the " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2793 |
"'{0}' package is not valid.").format(self.data) |
1352
5c92c9d342ef
11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
2794 |
return _("The signature data for the manifest is not valid.") |
1370
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2795 |
|
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2796 |
|
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2797 |
class UnknownErrors(ApiException): |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2798 |
"""Used to indicate that one or more exceptions were encountered. |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2799 |
This is intended for use with where multiple exceptions for multiple |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2800 |
files are encountered and the errors have been condensed into a |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2801 |
single exception and re-raised. One example case would be rmtree() |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2802 |
with shutil.Error.""" |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2803 |
|
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2804 |
def __init__(self, msg): |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2805 |
ApiException.__init__(self) |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2806 |
self.__msg = msg |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2807 |
|
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2808 |
def __str__(self): |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2809 |
return self.__msg |
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2810 |
|
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2811 |
|
1370
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2812 |
# Image creation exceptions |
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2813 |
class ImageCreationException(ApiException): |
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2814 |
def __init__(self, path): |
1736
727dda1e7968
11522 pkg should require publisher prefix to match repository information
Shawn Walker <srw@sun.com>
parents:
1710
diff
changeset
|
2815 |
ApiException.__init__(self) |
1370
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2816 |
self.path = path |
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2817 |
|
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2818 |
def __str__(self): |
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2819 |
raise NotImplementedError() |
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2820 |
|
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2821 |
|
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2822 |
class ImageAlreadyExists(ImageCreationException): |
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2823 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2824 |
return _("there is already an image at: {0}.\nTo override, use " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2825 |
"the -f (force) option.").format(self.path) |
1370
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2826 |
|
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2827 |
|
2097
068cc63b4d6e
17055 image configuration should use pkg.config classes
Shawn Walker <shawn.walker@oracle.com>
parents:
2089
diff
changeset
|
2828 |
class ImageCfgEmptyError(ApiException): |
068cc63b4d6e
17055 image configuration should use pkg.config classes
Shawn Walker <shawn.walker@oracle.com>
parents:
2089
diff
changeset
|
2829 |
"""Used to indicate that the image configuration is invalid.""" |
068cc63b4d6e
17055 image configuration should use pkg.config classes
Shawn Walker <shawn.walker@oracle.com>
parents:
2089
diff
changeset
|
2830 |
|
068cc63b4d6e
17055 image configuration should use pkg.config classes
Shawn Walker <shawn.walker@oracle.com>
parents:
2089
diff
changeset
|
2831 |
def __str__(self): |
2144
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2832 |
return _("The configuration data for the image rooted at " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2833 |
"{0} is empty or missing.").format(self.data) |
2144
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2834 |
|
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2835 |
|
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2836 |
class UnsupportedImageError(ApiException): |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2837 |
"""Used to indicate that the image at a specific location is in a format |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2838 |
not supported by this version of the pkg(5) API.""" |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2839 |
|
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2840 |
def __init__(self, path): |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2841 |
ApiException.__init__(self) |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2842 |
self.path = path |
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2843 |
|
2ac203b826ab
7276 /var/pkg metadata needs reorg (looks busy)
Shawn Walker <shawn.walker@oracle.com>
parents:
2126
diff
changeset
|
2844 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2845 |
return _("The image rooted at {0} is invalid or is not " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2846 |
"supported by this version of the packaging system.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2847 |
self.path) |
2097
068cc63b4d6e
17055 image configuration should use pkg.config classes
Shawn Walker <shawn.walker@oracle.com>
parents:
2089
diff
changeset
|
2848 |
|
068cc63b4d6e
17055 image configuration should use pkg.config classes
Shawn Walker <shawn.walker@oracle.com>
parents:
2089
diff
changeset
|
2849 |
|
1370
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2850 |
class CreatingImageInNonEmptyDir(ImageCreationException): |
face1fe579ab
11400 image objects should always have a root
Brock Pytlik <bpytlik@sun.com>
parents:
1369
diff
changeset
|
2851 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2852 |
return _("the specified image path is not empty: {0}.\nTo " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2853 |
"override, use the -f (force) option.").format(self.path) |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2854 |
|
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2855 |
|
2073
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2034
diff
changeset
|
2856 |
def _convert_error(e, ignored_errors=EmptyI): |
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2034
diff
changeset
|
2857 |
"""Converts the provided exception into an ApiException equivalent if |
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2034
diff
changeset
|
2858 |
possible. Returns a new exception object if converted or the original |
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2034
diff
changeset
|
2859 |
if not. |
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2034
diff
changeset
|
2860 |
|
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2034
diff
changeset
|
2861 |
'ignored_errors' is an optional list of errno values for which None |
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2034
diff
changeset
|
2862 |
should be returned. |
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2034
diff
changeset
|
2863 |
""" |
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2034
diff
changeset
|
2864 |
|
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2034
diff
changeset
|
2865 |
if not hasattr(e, "errno"): |
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
2034
diff
changeset
|
2866 |
return e |
2026
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2867 |
if e.errno in ignored_errors: |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2868 |
return None |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2869 |
if e.errno in (errno.EACCES, errno.EPERM): |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2870 |
return PermissionsException(e.filename) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2871 |
if e.errno == errno.EROFS: |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2872 |
return ReadOnlyFileSystemException(e.filename) |
d1b30615bc99
9196 pkg(5) should have support for cryptographic manifest signatures
Brock Pytlik <bpytlik@sun.com>
parents:
2022
diff
changeset
|
2873 |
return e |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2874 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2875 |
class LinkedImageException(ApiException): |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2876 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2877 |
def __init__(self, bundle=None, lin=None, exitrv=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2878 |
attach_bad_prop=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2879 |
attach_bad_prop_value=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2880 |
attach_child_notsup=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2881 |
attach_parent_notsup=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2882 |
attach_root_as_child=None, |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2883 |
attach_with_curpath=None, |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2884 |
child_bad_img=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2885 |
child_diverged=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2886 |
child_dup=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2887 |
child_not_in_altroot=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2888 |
child_not_nested=None, |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2889 |
child_op_failed=None, |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2890 |
child_path_notabs=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2891 |
child_unknown=None, |
2410
60b600d406df
18489 skip generating parent deps if we're running a build with parent deps
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2409
diff
changeset
|
2892 |
cmd_failed=None, |
3043
d0b8f7b429f3
18404810 linked image chokes on zonepaths which contain colons
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
3031
diff
changeset
|
2893 |
cmd_output_invalid=None, |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2894 |
detach_child_notsup=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2895 |
detach_from_parent=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2896 |
detach_parent_notsup=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2897 |
img_linked=None, |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2898 |
intermediate_image=None, |
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
2899 |
lin_malformed=None, |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2900 |
link_to_self=None, |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2901 |
parent_bad_img=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2902 |
parent_bad_notabs=None, |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2903 |
parent_bad_path=None, |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2904 |
parent_nested=None, |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2905 |
parent_not_in_altroot=None, |
2444
9170dcd9559d
18349 linked image code needs to be more resilient in the face of zoneadm failure
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2410
diff
changeset
|
2906 |
pkg_op_failed=None, |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2907 |
self_linked=None, |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
2908 |
self_not_child=None, |
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
2909 |
unparsable_output=None): |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2910 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2911 |
self.attach_bad_prop = attach_bad_prop |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2912 |
self.attach_bad_prop_value = attach_bad_prop_value |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2913 |
self.attach_child_notsup = attach_child_notsup |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2914 |
self.attach_parent_notsup = attach_parent_notsup |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2915 |
self.attach_root_as_child = attach_root_as_child |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2916 |
self.attach_with_curpath = attach_with_curpath |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2917 |
self.child_bad_img = child_bad_img |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2918 |
self.child_diverged = child_diverged |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2919 |
self.child_dup = child_dup |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2920 |
self.child_not_in_altroot = child_not_in_altroot |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2921 |
self.child_not_nested = child_not_nested |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2922 |
self.child_op_failed = child_op_failed |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2923 |
self.child_path_notabs = child_path_notabs |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2924 |
self.child_unknown = child_unknown |
2410
60b600d406df
18489 skip generating parent deps if we're running a build with parent deps
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2409
diff
changeset
|
2925 |
self.cmd_failed = cmd_failed |
3043
d0b8f7b429f3
18404810 linked image chokes on zonepaths which contain colons
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
3031
diff
changeset
|
2926 |
self.cmd_output_invalid = cmd_output_invalid |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2927 |
self.detach_child_notsup = detach_child_notsup |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2928 |
self.detach_from_parent = detach_from_parent |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2929 |
self.detach_parent_notsup = detach_parent_notsup |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2930 |
self.img_linked = img_linked |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2931 |
self.intermediate_image = intermediate_image |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2932 |
self.lin_malformed = lin_malformed |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2933 |
self.link_to_self = link_to_self |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2934 |
self.parent_bad_img = parent_bad_img |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2935 |
self.parent_bad_notabs = parent_bad_notabs |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2936 |
self.parent_bad_path = parent_bad_path |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2937 |
self.parent_nested = parent_nested |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2938 |
self.parent_not_in_altroot = parent_not_in_altroot |
2444
9170dcd9559d
18349 linked image code needs to be more resilient in the face of zoneadm failure
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2410
diff
changeset
|
2939 |
self.pkg_op_failed = pkg_op_failed |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2940 |
self.self_linked = self_linked |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2941 |
self.self_not_child = self_not_child |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
2942 |
self.unparsable_output = unparsable_output |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2943 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2944 |
# first deal with an error bundle |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2945 |
if bundle: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2946 |
assert type(bundle) in [tuple, list, set] |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2947 |
for e in bundle: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2948 |
assert isinstance(e, LinkedImageException) |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2949 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2950 |
# set default error return value |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2951 |
if exitrv == None: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2952 |
exitrv = pkgdefs.EXIT_OOPS |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2953 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2954 |
self.lix_err = None |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2955 |
self.lix_bundle = bundle |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2956 |
self.lix_exitrv = exitrv |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2957 |
return |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2958 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2959 |
err = None |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2960 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
2961 |
if attach_bad_prop is not None: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2962 |
err = _("Invalid linked image attach property: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2963 |
attach_bad_prop) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2964 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
2965 |
if attach_bad_prop_value is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2966 |
assert type(attach_bad_prop_value) in [tuple, list] |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2967 |
assert len(attach_bad_prop_value) == 2 |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2968 |
err = _("Invalid linked image attach property " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2969 |
"value: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2970 |
"=".join(attach_bad_prop_value)) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2971 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
2972 |
if attach_child_notsup is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2973 |
err = _("Linked image type does not support child " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2974 |
"attach: {0}").format(attach_child_notsup) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2975 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
2976 |
if attach_parent_notsup is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2977 |
err = _("Linked image type does not support parent " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2978 |
"attach: {0}").format(attach_parent_notsup) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2979 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
2980 |
if attach_root_as_child is not None: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2981 |
err = _("Cannot attach root image as child: {0}".format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2982 |
attach_root_as_child)) |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2983 |
|
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2984 |
if attach_with_curpath is not None: |
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2985 |
path, curpath = attach_with_curpath |
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2986 |
err = _("Cannot link images when an image is not at " |
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
2987 |
"its default location. The image currently " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2988 |
"located at:\n {curpath}\n" |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2989 |
"is normally located at:\n {path}\n").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2990 |
path=path, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2991 |
curpath=curpath, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2992 |
) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2993 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
2994 |
if child_bad_img is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2995 |
if exitrv == None: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2996 |
exitrv = pkgdefs.EXIT_EACCESS |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2997 |
if lin: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
2998 |
err = _("Can't initialize child image " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
2999 |
"({lin}) at path: {path}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3000 |
lin=lin, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3001 |
path=child_bad_img |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3002 |
) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3003 |
else: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3004 |
err = _("Can't initialize child image " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3005 |
"at path: {0}").format(child_bad_img) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3006 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3007 |
if child_diverged is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3008 |
if exitrv == None: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3009 |
exitrv = pkgdefs.EXIT_DIVERGED |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3010 |
err = _("Linked image is diverged: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3011 |
child_diverged) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3012 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3013 |
if child_dup is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3014 |
err = _("A linked child image with this name " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3015 |
"already exists: {0}").format(child_dup) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3016 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3017 |
if child_not_in_altroot is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3018 |
path, altroot = child_not_in_altroot |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3019 |
err = _("Child image '{path}' is not located " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3020 |
"within the parent's altroot '{altroot}'").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3021 |
path=path, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3022 |
altroot=altroot |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3023 |
) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3024 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3025 |
if child_not_nested is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3026 |
cpath, ppath = child_not_nested |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3027 |
err = _("Child image '{cpath}' is not nested " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3028 |
"within the parent image '{ppath}'").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3029 |
cpath=cpath, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3030 |
ppath=ppath, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3031 |
) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3032 |
|
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
3033 |
if child_op_failed is not None: |
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
3034 |
op, cpath, e = child_op_failed |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3035 |
if exitrv == None: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3036 |
exitrv = pkgdefs.EXIT_EACCESS |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3037 |
if lin: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3038 |
err = _("Failed '{op}' for child image " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3039 |
"({lin}) at path: {path}: " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3040 |
"{strerror}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3041 |
op=op, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3042 |
lin=lin, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3043 |
path=cpath, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3044 |
strerror=e, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3045 |
) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3046 |
else: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3047 |
err = _("Failed '{op}' for child image " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3048 |
"at path: {path}: {strerror}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3049 |
op=op, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3050 |
path=cpath, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3051 |
strerror=e, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3052 |
) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3053 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3054 |
if child_path_notabs is not None: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3055 |
err = _("Child path not absolute: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3056 |
child_path_notabs) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3057 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3058 |
if child_unknown is not None: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3059 |
err = _("Unknown child linked image: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3060 |
child_unknown) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3061 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3062 |
if cmd_failed is not None: |
2444
9170dcd9559d
18349 linked image code needs to be more resilient in the face of zoneadm failure
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2410
diff
changeset
|
3063 |
(rv, cmd, errout) = cmd_failed |
9170dcd9559d
18349 linked image code needs to be more resilient in the face of zoneadm failure
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2410
diff
changeset
|
3064 |
err = _("The following subprocess returned an " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3065 |
"unexpected exit code of {rv:d}:\n {cmd}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3066 |
rv=rv, cmd=cmd) |
2444
9170dcd9559d
18349 linked image code needs to be more resilient in the face of zoneadm failure
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2410
diff
changeset
|
3067 |
if not errout: |
9170dcd9559d
18349 linked image code needs to be more resilient in the face of zoneadm failure
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2410
diff
changeset
|
3068 |
return |
9170dcd9559d
18349 linked image code needs to be more resilient in the face of zoneadm failure
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2410
diff
changeset
|
3069 |
err += _("\nAnd generated the following error " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3070 |
"message:\n{errout}".format(errout=errout)) |
2410
60b600d406df
18489 skip generating parent deps if we're running a build with parent deps
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2409
diff
changeset
|
3071 |
|
3043
d0b8f7b429f3
18404810 linked image chokes on zonepaths which contain colons
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
3031
diff
changeset
|
3072 |
if cmd_output_invalid is not None: |
d0b8f7b429f3
18404810 linked image chokes on zonepaths which contain colons
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
3031
diff
changeset
|
3073 |
(cmd, output) = cmd_output_invalid |
d0b8f7b429f3
18404810 linked image chokes on zonepaths which contain colons
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
3031
diff
changeset
|
3074 |
err = _( |
d0b8f7b429f3
18404810 linked image chokes on zonepaths which contain colons
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
3031
diff
changeset
|
3075 |
"The following subprocess:\n" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3076 |
" {cmd}\n" |
3043
d0b8f7b429f3
18404810 linked image chokes on zonepaths which contain colons
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
3031
diff
changeset
|
3077 |
"Generated the following unexpected output:\n" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3078 |
"{output}\n".format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3079 |
cmd=" ".join(cmd), output="\n".join(output))) |
3043
d0b8f7b429f3
18404810 linked image chokes on zonepaths which contain colons
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
3031
diff
changeset
|
3080 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3081 |
if detach_child_notsup is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3082 |
err = _("Linked image type does not support " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3083 |
"child detach: {0}").format(detach_child_notsup) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3084 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3085 |
if detach_from_parent is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3086 |
if exitrv == None: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3087 |
exitrv = pkgdefs.EXIT_PARENTOP |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3088 |
err = _("Parent linked to child, can not detach " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3089 |
"child: {0}").format(detach_from_parent) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3090 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3091 |
if detach_parent_notsup is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3092 |
err = _("Linked image type does not support " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3093 |
"parent detach: {0}").format(detach_parent_notsup) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3094 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3095 |
if img_linked is not None: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3096 |
err = _("Image already a linked child: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3097 |
img_linked) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3098 |
|
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
3099 |
if intermediate_image is not None: |
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
3100 |
ppath, cpath, ipath = intermediate_image |
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
3101 |
err = _( |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3102 |
"Intermediate image '{ipath}' found between " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3103 |
"child '{cpath}' and " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3104 |
"parent '{ppath}'").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3105 |
ppath=ppath, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3106 |
cpath=cpath, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3107 |
ipath=ipath, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3108 |
) |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
3109 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3110 |
if lin_malformed is not None: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3111 |
err = _("Invalid linked image name '{0}'. " |
2823
8def820a649c
7140147 The error: Invalid linked image name: i2 Isn't descriptive enough
thejaswini.k@oracle.com
parents:
2743
diff
changeset
|
3112 |
"Linked image names have the following format " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3113 |
"'<linked_image plugin>:<linked_image name>'").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3114 |
lin_malformed) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3115 |
|
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
3116 |
if link_to_self is not None: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3117 |
err = _("Can't link image to itself: {0}") |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3118 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3119 |
if parent_bad_img is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3120 |
if exitrv == None: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3121 |
exitrv = pkgdefs.EXIT_EACCESS |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3122 |
err = _("Can't initialize parent image at path: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3123 |
parent_bad_img) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3124 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3125 |
if parent_bad_notabs is not None: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3126 |
err = _("Parent path not absolute: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3127 |
parent_bad_notabs) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3128 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3129 |
if parent_bad_path is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3130 |
if exitrv == None: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3131 |
exitrv = pkgdefs.EXIT_EACCESS |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3132 |
err = _("Can't access parent image at path: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3133 |
parent_bad_path) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3134 |
|
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
3135 |
if parent_nested is not None: |
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
3136 |
ppath, cpath = parent_nested |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3137 |
err = _("A parent image '{ppath}' can not be nested " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3138 |
"within a child image '{cpath}'").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3139 |
ppath=ppath, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3140 |
cpath=cpath, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3141 |
) |
3020
cc5d9bd44b37
18025813 remove dead linked images code
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2990
diff
changeset
|
3142 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3143 |
if parent_not_in_altroot is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3144 |
path, altroot = parent_not_in_altroot |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3145 |
err = _("Parent image '{path}' is not located " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3146 |
"within the child's altroot '{altroot}'").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3147 |
path=path, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3148 |
altroot=altroot |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3149 |
) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3150 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3151 |
if pkg_op_failed is not None: |
2444
9170dcd9559d
18349 linked image code needs to be more resilient in the face of zoneadm failure
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2410
diff
changeset
|
3152 |
assert lin |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3153 |
(op, exitrv, errout, e) = pkg_op_failed |
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3154 |
assert op is not None |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3155 |
|
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3156 |
if e is None: |
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3157 |
err = _(""" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3158 |
A '{op}' operation failed for child '{lin}' with an unexpected |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3159 |
return value of {exitrv:d} and generated the following output: |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3160 |
{errout} |
2444
9170dcd9559d
18349 linked image code needs to be more resilient in the face of zoneadm failure
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2410
diff
changeset
|
3161 |
|
9170dcd9559d
18349 linked image code needs to be more resilient in the face of zoneadm failure
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2410
diff
changeset
|
3162 |
""" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3163 |
).format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3164 |
lin=lin, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3165 |
op=op, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3166 |
exitrv=exitrv, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3167 |
errout=errout, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3168 |
) |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3169 |
else: |
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3170 |
err = _(""" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3171 |
A '{op}' operation failed for child '{lin}' with an unexpected |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3172 |
exception: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3173 |
{e} |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3174 |
|
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3175 |
The child generated the following output: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3176 |
{errout} |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3177 |
|
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3178 |
""" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3179 |
).format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3180 |
lin=lin, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3181 |
op=op, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3182 |
errout=errout, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3183 |
e=e, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3184 |
) |
2444
9170dcd9559d
18349 linked image code needs to be more resilient in the face of zoneadm failure
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2410
diff
changeset
|
3185 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3186 |
if self_linked is not None: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3187 |
err = _("Current image already a linked child: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3188 |
self_linked) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3189 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3190 |
if self_not_child is not None: |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3191 |
if exitrv == None: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3192 |
exitrv = pkgdefs.EXIT_NOPARENT |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3193 |
err = _("Current image is not a linked child: {0}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3194 |
self_not_child) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3195 |
|
2743
9f6a3b4462c8
7182704 None is not an operation
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2701
diff
changeset
|
3196 |
if unparsable_output is not None: |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3197 |
(op, errout, e) = unparsable_output |
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3198 |
err = _(""" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3199 |
A '{op}' operation for child '{lin}' generated non-json output. |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3200 |
The json parser failed with the following error: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3201 |
{e} |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3202 |
|
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3203 |
The child generated the following output: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3204 |
{errout} |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3205 |
|
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3206 |
""" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3207 |
).format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3208 |
lin=lin, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3209 |
op=op, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3210 |
e=e, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3211 |
errout=errout, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3212 |
) |
2690
11a8cae074e0
7140224 package downloaded messages displayed twice for each zone
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2681
diff
changeset
|
3213 |
|
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3214 |
# set default error return value |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3215 |
if exitrv == None: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3216 |
exitrv = pkgdefs.EXIT_OOPS |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3217 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3218 |
self.lix_err = err |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3219 |
self.lix_bundle = None |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3220 |
self.lix_exitrv = exitrv |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3221 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3222 |
def __str__(self): |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3223 |
assert self.lix_err or self.lix_bundle |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3224 |
assert not (self.lix_err and self.lix_bundle), \ |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3225 |
"self.lix_err = {0}, self.lix_bundle = {1}".format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3226 |
str(self.lix_err), str(self.lix_bundle)) |
2339
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3227 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3228 |
# single error |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3229 |
if self.lix_err: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3230 |
return self.lix_err |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3231 |
|
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3232 |
# concatenate multiple errors |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3233 |
bundle_str = [] |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3234 |
for e in self.lix_bundle: |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3235 |
bundle_str.append(str(e)) |
aa5954c06b9d
16148 need linked image support for zones, phase 1
Edward Pilatowicz <edward.pilatowicz@oracle.com>
parents:
2335
diff
changeset
|
3236 |
return "\n".join(bundle_str) |
2452
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3237 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3238 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3239 |
class FreezePkgsException(ApiException): |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3240 |
"""Used if an argument to pkg freeze isn't valid.""" |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3241 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3242 |
def __init__(self, multiversions=None, unmatched_wildcards=None, |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3243 |
version_mismatch=None, versionless_uninstalled=None): |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3244 |
ApiException.__init__(self) |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3245 |
self.multiversions = multiversions |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3246 |
self.unmatched_wildcards = unmatched_wildcards |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3247 |
self.version_mismatch = version_mismatch |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3248 |
self.versionless_uninstalled = versionless_uninstalled |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3249 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3250 |
def __str__(self): |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3251 |
res = [] |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3252 |
if self.multiversions: |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3253 |
s = _("""\ |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3254 |
The following packages were frozen at two different versions by |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3255 |
the patterns provided. The package stem and the versions it was frozen at are |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3256 |
provided:""") |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3257 |
res += [s] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3258 |
res += ["\t{0}\t{1}".format(stem, " ".join([ |
2452
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3259 |
str(v) for v in versions])) |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3260 |
for stem, versions in sorted(self.multiversions)] |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3261 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3262 |
if self.unmatched_wildcards: |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3263 |
s = _("""\ |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3264 |
The following patterns contained wildcards but matched no |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3265 |
installed packages.""") |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3266 |
res += [s] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3267 |
res += ["\t{0}".format(pat) for pat in sorted( |
2452
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3268 |
self.unmatched_wildcards)] |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3269 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3270 |
if self.version_mismatch: |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3271 |
s = _("""\ |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3272 |
The following patterns attempted to freeze the listed packages |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3273 |
at a version different from the version at which the packages are installed.""") |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3274 |
res += [s] |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3275 |
for pat in sorted(self.version_mismatch): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3276 |
res += ["\t{0}".format(pat)] |
2452
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3277 |
if len(self.version_mismatch[pat]) > 1: |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3278 |
res += [ |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3279 |
"\t\t{0}".format(stem) |
2452
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3280 |
for stem |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3281 |
in self.version_mismatch[pat] |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3282 |
] |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3283 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3284 |
if self.versionless_uninstalled: |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3285 |
s = _("""\ |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3286 |
The following patterns don't match installed packages and |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3287 |
contain no version information. Uninstalled packages can only be frozen by |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3288 |
providing a version at which to freeze them.""") |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3289 |
res += [s] |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3290 |
res += ["\t{0}".format(p) for p in sorted( |
2452
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3291 |
self.versionless_uninstalled)] |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3292 |
return "\n".join(res) |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3293 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3294 |
class InvalidFreezeFile(ApiException): |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3295 |
"""Used to indicate the freeze state file could not be loaded.""" |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3296 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3297 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3298 |
return _("The freeze state file '{0}' is invalid.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3299 |
self.data) |
2452
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3300 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3301 |
class UnknownFreezeFileVersion(ApiException): |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3302 |
"""Used when the version on the freeze state file isn't the version |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3303 |
that's expected.""" |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3304 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3305 |
def __init__(self, found_ver, expected_ver, location): |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3306 |
self.found = found_ver |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3307 |
self.expected = expected_ver |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3308 |
self.loc = location |
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3309 |
|
3be84ba08176
18441 pkg needs a freeze mechanism
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2445
diff
changeset
|
3310 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3311 |
return _("The freeze state file '{loc}' was expected to have " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3312 |
"a version of {exp}, but its version was {found}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3313 |
exp=self.expected, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3314 |
found=self.found, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3315 |
loc=self.loc, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3316 |
) |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3317 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3318 |
class InvalidOptionError(ApiException): |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3319 |
"""Used to indicate an issue with verifying options passed to a certain |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3320 |
operation.""" |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3321 |
|
3185
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3322 |
GENERIC = "generic" # generic option violation |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3323 |
OPT_REPEAT = "opt_repeat" # option repetition is not allowed |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3324 |
ARG_REPEAT = "arg_repeat" # argument repetition is not allowed |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3325 |
ARG_INVALID = "arg_invalid" # argument is invalid |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3326 |
INCOMPAT = "incompat" # option 'a' can not be specified with option 'b' |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3327 |
REQUIRED = "required" # option 'a' requires option 'b' |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3328 |
REQUIRED_ANY = "required_any" # option 'a' requires option 'b', 'c' or more |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3329 |
XOR = "xor" # either option 'a' or option 'b' must be specified |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3330 |
|
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3331 |
def __init__(self, err_type=GENERIC, options=[], msg=None, |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3332 |
valid_args=[]): |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3333 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3334 |
self.err_type = err_type |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3335 |
self.options = options |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3336 |
self.msg = msg |
3185
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3337 |
self.valid_args = valid_args |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3338 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3339 |
def __str__(self): |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3340 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3341 |
# In case the user provided a custom message we just take it and |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3342 |
# append the according options. |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3343 |
if self.msg is not None: |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3344 |
if self.options: |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3345 |
self.msg += ": " |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3346 |
self.msg += " ".join(self.options) |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3347 |
return self.msg |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3348 |
|
2980
783f0eef9725
15507548 cert validation needs to validate all certificates before raising e
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2977
diff
changeset
|
3349 |
if self.err_type == self.OPT_REPEAT: |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3350 |
assert len(self.options) == 1 |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3351 |
return _("Option '{option}' may not be repeated.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3352 |
option=self.options[0]) |
2875
09e276ba70c6
15804991 option mangling and verification should be part of the API, not the CLI client
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2847
diff
changeset
|
3353 |
elif self.err_type == self.ARG_REPEAT: |
09e276ba70c6
15804991 option mangling and verification should be part of the API, not the CLI client
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2847
diff
changeset
|
3354 |
assert len(self.options) == 2 |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3355 |
return _("Argument '{op1}' for option '{op2}' may " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3356 |
"not be repeated.").format(op1=self.options[0], |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3357 |
op2=self.options[1]) |
3031
14865bd92db6
17642065 stacktrace when passing invalid argument to -F
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3020
diff
changeset
|
3358 |
elif self.err_type == self.ARG_INVALID: |
14865bd92db6
17642065 stacktrace when passing invalid argument to -F
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3020
diff
changeset
|
3359 |
assert len(self.options) == 2 |
3185
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3360 |
s = _("Argument '{op1}' for option '{op2}' is " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3361 |
"invalid.").format(op1=self.options[0], |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3362 |
op2=self.options[1]) |
3185
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3363 |
if self.valid_args: |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3364 |
s += _("\nSupported: {0}").format(", ".join( |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3365 |
self.valid_args)) |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3366 |
return s |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3367 |
elif self.err_type == self.INCOMPAT: |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3368 |
assert len(self.options) == 2 |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3369 |
return _("The '{op1}' and '{op2}' option may " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3370 |
"not be combined.").format(op1=self.options[0], |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3371 |
op2=self.options[1]) |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3372 |
elif self.err_type == self.REQUIRED: |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3373 |
assert len(self.options) == 2 |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3374 |
return _("'{op1}' may only be used with " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3375 |
"'{op2}'.").format(op1=self.options[0], |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3376 |
op2=self.options[1]) |
3185
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3377 |
elif self.err_type == self.REQUIRED_ANY: |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3378 |
assert len(self.options) > 2 |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3379 |
return _("'{op1}' may only be used with " |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3380 |
"'{op2}' or {op3}.").format(op1=self.options[0], |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3381 |
op2=", ".join(self.options[1:-1]), |
2e55bdb918e4
20283125 pkg set-publisher traceback for --add-property-value after --set-property
Xiaobo Shen <xiaobo.shen@oracle.com>
parents:
3167
diff
changeset
|
3382 |
op3=self.options[-1]) |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3383 |
elif self.err_type == self.XOR: |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3384 |
assert len(self.options) == 2 |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3385 |
return _("Either '{op1}' or '{op2}' must be " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3386 |
"specified").format(op1=self.options[0], |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3110
diff
changeset
|
3387 |
op2=self.options[1]) |
2839
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3388 |
else: |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3389 |
return _("invalid option(s): ") + " ".join(self.options) |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3390 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3391 |
class InvalidOptionErrors(ApiException): |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3392 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3393 |
def __init__(self, errors): |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3394 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3395 |
self.errors = [] |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3396 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3397 |
assert (isinstance(errors, list) or isinstance(errors, tuple) or |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3398 |
isinstance(errors, set) or |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3399 |
isinstance(errors, InvalidOptionError)) |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3400 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3401 |
if isinstance(errors, InvalidOptionError): |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3402 |
self.errors.append(errors) |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3403 |
else: |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3404 |
self.errors = errors |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3405 |
|
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3406 |
def __str__(self): |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3407 |
msgs = [] |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3408 |
for e in self.errors: |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3409 |
msgs.append(str(e)) |
7b0fc73bf146
15981296 pkg API should have basic input checking for clients other than the CLI
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2832
diff
changeset
|
3410 |
return "\n".join(msgs) |
2840
2f6f88362fd1
15981296 pkg API should have basic input checking for clients other than the CLI (2)
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2839
diff
changeset
|
3411 |
|
3065
1dbcb0bd5069
15786486 problem in UTILITY/ZONES
Kartik Gupta <kartik.k.gupta@oracle.com>
parents:
3043
diff
changeset
|
3412 |
class UnexpectedLinkError(ApiException): |
1dbcb0bd5069
15786486 problem in UTILITY/ZONES
Kartik Gupta <kartik.k.gupta@oracle.com>
parents:
3043
diff
changeset
|
3413 |
"""Used to indicate that an image state file has been replaced |
1dbcb0bd5069
15786486 problem in UTILITY/ZONES
Kartik Gupta <kartik.k.gupta@oracle.com>
parents:
3043
diff
changeset
|
3414 |
with a symlink.""" |
1dbcb0bd5069
15786486 problem in UTILITY/ZONES
Kartik Gupta <kartik.k.gupta@oracle.com>
parents:
3043
diff
changeset
|
3415 |
|
1dbcb0bd5069
15786486 problem in UTILITY/ZONES
Kartik Gupta <kartik.k.gupta@oracle.com>
parents:
3043
diff
changeset
|
3416 |
def __init__(self, path, filename, errno): |
1dbcb0bd5069
15786486 problem in UTILITY/ZONES
Kartik Gupta <kartik.k.gupta@oracle.com>
parents:
3043
diff
changeset
|
3417 |
self.path = path |
1dbcb0bd5069
15786486 problem in UTILITY/ZONES
Kartik Gupta <kartik.k.gupta@oracle.com>
parents:
3043
diff
changeset
|
3418 |
self.filename = filename |
1dbcb0bd5069
15786486 problem in UTILITY/ZONES
Kartik Gupta <kartik.k.gupta@oracle.com>
parents:
3043
diff
changeset
|
3419 |
self.errno = errno |
1dbcb0bd5069
15786486 problem in UTILITY/ZONES
Kartik Gupta <kartik.k.gupta@oracle.com>
parents:
3043
diff
changeset
|
3420 |
|
1dbcb0bd5069
15786486 problem in UTILITY/ZONES
Kartik Gupta <kartik.k.gupta@oracle.com>
parents:
3043
diff
changeset
|
3421 |
def __str__(self): |
3195
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3422 |
return _("Cannot update file: '{file}' at path " |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3423 |
"'{path}', contains a symlink. " |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3424 |
"[Error '{errno:d}': '{error}']").format( |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3425 |
error=os.strerror(self.errno), |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3426 |
errno=self.errno, |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3427 |
path=self.path, |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3428 |
file=self.filename, |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3429 |
) |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3430 |
|
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3431 |
|
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3432 |
class InvalidConfigFile(ApiException): |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3433 |
"""Used to indicate that a configuration file is invalid |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3434 |
or broken""" |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3435 |
|
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3436 |
def __init__(self, path): |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3437 |
self.path = path |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3438 |
|
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3439 |
def __str__(self): |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3440 |
return _("Cannot parse configuration file " |
2c676076a788
15780656 Symlinking files in the global zone can cause error containing first line of the target file
Chao Pan <chao.pan@oracle.com>
parents:
3185
diff
changeset
|
3441 |
"{path}'.").format(path=self.path) |