client/rhel/rhn-client-tools/src/up2date_client/config.py | 2 -
client/rhel/rhn-client-tools/src/up2date_client/rhnChannel.py | 1
client/tools/action-rpms/rhn-applet-actions/rhn_applet.py | 15 ++--------
client/tools/osad/src/osad.py | 10 ------
client/tools/rhncustominfo/rhn-custom-info.py | 15 ++--------
5 files changed, 10 insertions(+), 33 deletions(-)
New commits:
commit 9dc05b9abbd30fe7f8d00a042ab0b60a13c08af4
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Mar 25 14:28:56 2011 +0100
no need to support rhel2
diff --git a/client/tools/action-rpms/rhn-applet-actions/rhn_applet.py
b/client/tools/action-rpms/rhn-applet-actions/rhn_applet.py
index ebcbeb5..b132875 100755
--- a/client/tools/action-rpms/rhn-applet-actions/rhn_applet.py
+++ b/client/tools/action-rpms/rhn-applet-actions/rhn_applet.py
@@ -99,17 +99,10 @@ def _create_server_obj(server_url):
def read_cfg_val(obj, key):
- """given up2date's rhel 2.1 vs 3 config 'obj', return the
value"""
- if hasattr(obj, 'readEntry'):
- # rhel 2.1 style, obj.readEntry("serverURL")
- return obj.readEntry(key)
- if hasattr(obj, "__setitem__"):
- # rhel 3 style, obj['serverURL']
- if obj.has_key(key):
- return obj[key]
- return None
- raise Exception("unknow up2date config object")
-
+ """ return obj[key] or None if key does not exist"""
+ if obj.has_key(key):
+ return obj[key]
+ return None
def update_applet_cfg():
diff --git a/client/tools/osad/src/osad.py b/client/tools/osad/src/osad.py
index bd5fb9d..cd24654 100644
--- a/client/tools/osad/src/osad.py
+++ b/client/tools/osad/src/osad.py
@@ -331,9 +331,6 @@ class Runner(jabber_lib.Runner):
def get_up2date_config(self):
if self._up2date_config is None:
self._up2date_config = initUp2dateConfig()
- if not hasattr(self._up2date_config, '__getitem__'):
- # Old interface
- self._up2date_config = OldUp2dateConfig(self._up2date_config)
return self._up2date_config
def build_rpclib_params(self, config):
@@ -363,12 +360,5 @@ class Runner(jabber_lib.Runner):
username=username, password=password, resource=resource)
return auth_info
-class OldUp2dateConfig:
- def __init__(self, config_obj):
- self._config_obj = config_obj
-
- def __getitem__(self, name):
- return self._config_obj.readEntry(name)
-
if __name__ == '__main__':
sys.exit(main() or 0)
diff --git a/client/tools/rhncustominfo/rhn-custom-info.py
b/client/tools/rhncustominfo/rhn-custom-info.py
index 21eec26..64878b1 100755
--- a/client/tools/rhncustominfo/rhn-custom-info.py
+++ b/client/tools/rhncustominfo/rhn-custom-info.py
@@ -93,18 +93,11 @@ def create_server_obj(server_url):
def read_cfg_val(obj, key):
- """given up2date's rhel 2.1 vs 3 config 'obj', return the
value"""
- if hasattr(obj, 'readEntry'):
- # rhel 2.1 style, obj.readEntry("serverURL")
- return obj.readEntry(key)
- elif hasattr(obj, "__setitem__"):
- # rhel 3 style, obj['serverURL']
- if obj.has_key(key):
- return obj[key]
- else:
- raise "unknown config option: %s" % key
+ """ return obj[key] or None if key does not exists """
+ if obj.has_key(key):
+ return obj[key]
else:
- raise "unknown up2date config object"
+ raise "unknown config option: %s" % key
def read_username():
commit 65f1fd8f92c489b4aba7b75fc70e6ed2286751f5
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Mar 25 13:36:47 2011 +0100
no need to assign variable for test if it exist
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/config.py
b/client/rhel/rhn-client-tools/src/up2date_client/config.py
index c4b78bd..25c6fcd 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/config.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/config.py
@@ -299,7 +299,7 @@ def initUp2dateConfig(cfg_file =
"/etc/sysconfig/rhn/up2date"):
"""This function is the right way to get at the up2date
config."""
global cfg
try:
- cfg = cfg
+ cfg
except NameError:
cfg = None
commit 5fa2da67ac78601184857735621c4722ccfa104b
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Mar 24 17:58:05 2011 +0100
add docstring
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnChannel.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnChannel.py
index b6a94d4..2348e14 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnChannel.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnChannel.py
@@ -85,6 +85,7 @@ cmdline_pkgs = []
global selected_channels
selected_channels = None
def getChannels(force=None, label_whitelist=None):
+ """ return rhnChannelList containing list of channel we are subscribed
to """
cfg = config.initUp2dateConfig()
global selected_channels
if not selected_channels and not force:
Show replies by thread