author | John Rice <john.rice@oracle.com> |
Mon, 05 Jul 2010 11:40:13 +0100 | |
changeset 1965 | 78862a3f8cc9 |
parent 1948 | 2b0682839132 |
child 1987 | 34494822ad14 |
permissions | -rw-r--r-- |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1374
diff
changeset
|
1 |
#!/usr/bin/python2.6 |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
2 |
# |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
4 |
# |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
8 |
# |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
13 |
# |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
19 |
# |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
21 |
# |
1948
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
22 |
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
23 |
# |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
24 |
|
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
25 |
import os |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
26 |
import sys |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
27 |
import time |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
28 |
import getopt |
1374
eeee082bae60
11350 update-refresh.sh fails to find '_' (gettext)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1345
diff
changeset
|
29 |
import gettext |
eeee082bae60
11350 update-refresh.sh fails to find '_' (gettext)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1345
diff
changeset
|
30 |
import locale |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
31 |
|
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
32 |
import pkg.client.progress as progress |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
33 |
import pkg.client.api_errors as api_errors |
1761
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
34 |
import pkg.gui.misc_non_gui as nongui_misc |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
35 |
import pkg.gui.enumerations as enumerations |
1374
eeee082bae60
11350 update-refresh.sh fails to find '_' (gettext)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1345
diff
changeset
|
36 |
import pkg.misc as misc |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
37 |
from pkg.client import global_settings |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
38 |
from cPickle import UnpicklingError |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
39 |
|
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
40 |
PKG_CLIENT_NAME = "check_for_updates" |
1948
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
41 |
CACHE_VERSION = 3 |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
42 |
CACHE_NAME = ".last_refresh_cache" |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
43 |
|
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
44 |
def __check_for_updates(image_directory, nice, silent): |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
45 |
if nice: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
46 |
os.nice(20) |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
47 |
global_settings.client_name = PKG_CLIENT_NAME |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
48 |
pr = progress.NullProgressTracker() |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
49 |
|
1336
2ea22dad29e3
10192 /usr/lib/pm-checkforupdates emits warning when DISPLAY is not set.
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1277
diff
changeset
|
50 |
message = None |
2ea22dad29e3
10192 /usr/lib/pm-checkforupdates emits warning when DISPLAY is not set.
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1277
diff
changeset
|
51 |
try: |
1761
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
52 |
api_obj = nongui_misc.get_api_object(image_directory, pr) |
1336
2ea22dad29e3
10192 /usr/lib/pm-checkforupdates emits warning when DISPLAY is not set.
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1277
diff
changeset
|
53 |
except api_errors.VersionException, e: |
1374
eeee082bae60
11350 update-refresh.sh fails to find '_' (gettext)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1345
diff
changeset
|
54 |
message = "Version mismatch: expected version %d, got version %d" % \ |
1336
2ea22dad29e3
10192 /usr/lib/pm-checkforupdates emits warning when DISPLAY is not set.
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1277
diff
changeset
|
55 |
(e.expected_version, e.received_version) |
2ea22dad29e3
10192 /usr/lib/pm-checkforupdates emits warning when DISPLAY is not set.
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1277
diff
changeset
|
56 |
except api_errors.ImageNotFoundException, e: |
1374
eeee082bae60
11350 update-refresh.sh fails to find '_' (gettext)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1345
diff
changeset
|
57 |
message = "%s is not an install image" % e.user_dir |
1761
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
58 |
except api_errors.ApiException, e: |
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
59 |
message = "Unexpected exception: %s" % str(e) |
1336
2ea22dad29e3
10192 /usr/lib/pm-checkforupdates emits warning when DISPLAY is not set.
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1277
diff
changeset
|
60 |
if message != None: |
2ea22dad29e3
10192 /usr/lib/pm-checkforupdates emits warning when DISPLAY is not set.
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1277
diff
changeset
|
61 |
if debug: |
1374
eeee082bae60
11350 update-refresh.sh fails to find '_' (gettext)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1345
diff
changeset
|
62 |
print "Failed to get Api object: %s" % message |
1336
2ea22dad29e3
10192 /usr/lib/pm-checkforupdates emits warning when DISPLAY is not set.
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1277
diff
changeset
|
63 |
return enumerations.UPDATES_UNDETERMINED |
2ea22dad29e3
10192 /usr/lib/pm-checkforupdates emits warning when DISPLAY is not set.
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1277
diff
changeset
|
64 |
|
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
65 |
if api_obj == None: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
66 |
return enumerations.UPDATES_UNDETERMINED |
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
67 |
ret = __check_last_refresh(api_obj, silent) |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
68 |
if ret != enumerations.UPDATES_UNDETERMINED: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
69 |
return ret |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
70 |
elif debug: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
71 |
print "Updates undetermined in check_last_refresh" |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
72 |
|
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
73 |
try: |
1277
fb41b4b4c476
10404 Traceback in pm-checkforupdates
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1228
diff
changeset
|
74 |
stuff_to_do, opensolaris_image = \ |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
75 |
api_obj.plan_update_all(sys.argv[0], |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
76 |
refresh_catalogs = True, |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
77 |
noexecute = True, force = True, verbose = False) |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
78 |
except api_errors.ApiException, e: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
79 |
if debug: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
80 |
print "Exception occurred: ", str(e) |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
81 |
return enumerations.UPDATES_UNDETERMINED |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
82 |
if debug: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
83 |
print "stuff_to_do: ", stuff_to_do |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
84 |
print "opensolaris_image: ", opensolaris_image |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
85 |
|
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
86 |
__dump_updates_available(api_obj, stuff_to_do, silent) |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
87 |
if stuff_to_do: |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
88 |
if debug: |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
89 |
print "Updates Available" |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
90 |
return enumerations.UPDATES_AVAILABLE |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
91 |
else: |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
92 |
if debug: |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
93 |
print "No updates Available" |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
94 |
return enumerations.NO_UPDATES_AVAILABLE |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
95 |
|
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
96 |
def __check_last_refresh(api_obj, silent): |
1761
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
97 |
cache_dir = nongui_misc.get_cache_dir(api_obj) |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
98 |
if not cache_dir: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
99 |
return enumerations.UPDATES_UNDETERMINED |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
100 |
try: |
1761
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
101 |
info = nongui_misc.read_cache_file(os.path.join( |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
102 |
cache_dir, CACHE_NAME + '.cpl')) |
1761
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
103 |
if len(info) == 0: |
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
104 |
if debug: |
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
105 |
print "No cache" |
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
106 |
return enumerations.UPDATES_UNDETERMINED |
1948
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
107 |
# pylint: disable-msg=E1103 |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
108 |
if info.get("version") != CACHE_VERSION: |
1345
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
109 |
if debug: |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
110 |
print "Cache version mismatch:", \ |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
111 |
info.get("version"), CACHE_VERSION |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
112 |
return enumerations.UPDATES_UNDETERMINED |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
113 |
if info.get("os_release") != os.uname()[2]: |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
114 |
if debug: |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
115 |
print "OS release mismatch:", \ |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
116 |
info.get("os_release"), os.uname()[2] |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
117 |
return enumerations.UPDATES_UNDETERMINED |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
118 |
if info.get("os_version") != os.uname()[3]: |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
119 |
if debug: |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
120 |
print "OS version mismatch:", \ |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
121 |
info.get("os_version"), os.uname()[3] |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
122 |
return enumerations.UPDATES_UNDETERMINED |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
123 |
old_publishers = info.get("publishers") |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
124 |
count = 0 |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
125 |
for p in api_obj.get_publishers(): |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
126 |
if p.disabled: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
127 |
continue |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
128 |
try: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
129 |
if old_publishers[p.prefix] != p.last_refreshed: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
130 |
return enumerations.UPDATES_UNDETERMINED |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
131 |
except KeyError: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
132 |
return enumerations.UPDATES_UNDETERMINED |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
133 |
count += 1 |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
134 |
|
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
135 |
if count != len(old_publishers): |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
136 |
return enumerations.UPDATES_UNDETERMINED |
1948
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
137 |
n_updates = 0 |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
138 |
n_installs = 0 |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
139 |
n_removes = 0 |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
140 |
if info.get("updates_available"): |
1948
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
141 |
n_updates = info.get("updates") |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
142 |
n_installs = info.get("installs") |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
143 |
n_removes = info.get("removes") |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
144 |
# pylint: enable-msg=E1103 |
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
145 |
if not silent: |
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
146 |
if n_updates > 0: |
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
147 |
print "n_updates: ", n_updates |
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
148 |
if n_installs > 0: |
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
149 |
print "n_installs: ", n_installs |
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
150 |
if n_removes > 0: |
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
151 |
print "n_removes: ", n_removes |
1948
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
152 |
if (n_updates + n_installs + n_removes) > 0: |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
153 |
return enumerations.UPDATES_AVAILABLE |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
154 |
else: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
155 |
return enumerations.NO_UPDATES_AVAILABLE |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
156 |
|
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
157 |
except (UnpicklingError, IOError): |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
158 |
return enumerations.UPDATES_UNDETERMINED |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
159 |
|
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
160 |
def __dump_updates_available(api_obj, stuff_to_do, silent): |
1761
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
161 |
cache_dir = nongui_misc.get_cache_dir(api_obj) |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
162 |
if not cache_dir: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
163 |
return |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
164 |
publisher_list = {} |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
165 |
for p in api_obj.get_publishers(): |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
166 |
if p.disabled: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
167 |
continue |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
168 |
publisher_list[p.prefix] = p.last_refreshed |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
169 |
if debug: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
170 |
print "publisher_list:", publisher_list |
1948
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
171 |
n_installs = 0 |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
172 |
n_removes = 0 |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
173 |
n_updates = 0 |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
174 |
plan_desc = api_obj.describe() |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
175 |
if plan_desc: |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
176 |
plan = plan_desc.get_changes() |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
177 |
for pkg_plan in plan: |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
178 |
orig = pkg_plan[0] |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
179 |
dest = pkg_plan[1] |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
180 |
if orig and dest: |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
181 |
n_updates += 1 |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
182 |
elif not orig and dest: |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
183 |
n_installs += 1 |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
184 |
elif orig and not dest: |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
185 |
n_removes += 1 |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
186 |
dump_info = {} |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
187 |
dump_info["version"] = CACHE_VERSION |
1345
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
188 |
dump_info["os_release"] = os.uname()[2] |
6d5885f81a6f
11141 Update All button enabled in PM on b122 (when no updates are available)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1336
diff
changeset
|
189 |
dump_info["os_version"] = os.uname()[3] |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
190 |
dump_info["updates_available"] = stuff_to_do |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
191 |
dump_info["publishers"] = publisher_list |
1948
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
192 |
dump_info["updates"] = n_updates |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
193 |
dump_info["installs"] = n_installs |
2b0682839132
10730 Updatemanager notification area tooltip should include the number of updates
Padraig O'Briain <padraig.obriain@oracle.com>
parents:
1761
diff
changeset
|
194 |
dump_info["removes"] = n_removes |
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
195 |
if not silent: |
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
196 |
print "n_updates: ", n_updates |
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
197 |
print "n_installs: ", n_installs |
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
198 |
print "n_removes: ", n_removes |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
199 |
|
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
200 |
try: |
1761
b2d8237ac690
14481 Package version Info image lock exception not handled
John Rice <john.rice@sun.com>
parents:
1516
diff
changeset
|
201 |
nongui_misc.dump_cache_file(os.path.join( |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
202 |
cache_dir, CACHE_NAME + '.cpl'), dump_info) |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
203 |
except IOError, e: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
204 |
if debug: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
205 |
print "Failed to dump cache: %s" % str(e) |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
206 |
|
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
207 |
return |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
208 |
|
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
209 |
############################################################################### |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
210 |
#-----------------------------------------------------------------------------# |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
211 |
# Main |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
212 |
#-----------------------------------------------------------------------------# |
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
213 |
|
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
214 |
def main(image_directory, nice, silent): |
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
215 |
return __check_for_updates(image_directory, nice, silent) |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
216 |
|
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
217 |
if __name__ == '__main__': |
1374
eeee082bae60
11350 update-refresh.sh fails to find '_' (gettext)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1345
diff
changeset
|
218 |
misc.setlocale(locale.LC_ALL, "") |
eeee082bae60
11350 update-refresh.sh fails to find '_' (gettext)
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1345
diff
changeset
|
219 |
gettext.install("pkg", "/usr/share/locale") |
1201
fca0d56e685c
8631 abnormal heavy memory consumption of updatemanagernotifier
Padraig O'Briain <padraig.obriain@sun.com>
parents:
diff
changeset
|
220 |
debug = False |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
221 |
set_nice = False |
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
222 |
set_silent = False |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
223 |
try: |
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
224 |
opts, pargs = getopt.getopt(sys.argv[1:], "ns", ["nice", "silent"]) |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
225 |
except getopt.GetoptError, ex: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
226 |
print "Usage: illegal option -- %s" % ex.opt |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
227 |
sys.exit(enumerations.UPDATES_UNDETERMINED) |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
228 |
if len(pargs) != 1: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
229 |
print "Usage: One argument, image directory must be specified" |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
230 |
sys.exit(enumerations.UPDATES_UNDETERMINED) |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
231 |
image_dir = pargs[0] |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
232 |
for opt, args in opts: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
233 |
if debug: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
234 |
print "opt: ", opt |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
235 |
print "args: ", args |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
236 |
if opt in ( "-n", "--nice"): |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
237 |
set_nice = True |
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
238 |
elif opt in ( "-s", "--silent"): |
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
239 |
set_silent = True |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
240 |
if debug: |
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
241 |
print "Start check_for_updates for: ", image_dir, set_nice, set_silent |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
242 |
a = time.time() |
1965
78862a3f8cc9
16399 update-manager cronjob pollutes root mailbox with noise
John Rice <john.rice@oracle.com>
parents:
1948
diff
changeset
|
243 |
return_value = main(image_dir, set_nice, set_silent) |
1228
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
244 |
if debug: |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
245 |
print "time taken: ", time.time() - a |
07ef6e279231
9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents:
1217
diff
changeset
|
246 |
sys.exit(return_value) |