client/rhel/rhnlib/rhn/rpclib.py | 34 ------------------------
client/tools/osad/osad.spec | 2 -
client/tools/osad/src/osad.py | 31 +++++++++++++++++++++
client/tools/rhncfg/config_common/repository.py | 31 +++++++++++++++++++++
client/tools/rhncfg/rhncfg.spec | 2 -
client/tools/rhnpush/rhnpush.spec | 3 --
client/tools/rhnpush/uploadLib.py | 4 ++
7 files changed, 66 insertions(+), 41 deletions(-)
New commits:
commit f3be803b4b0b6545811268911d24288aff774d39
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Tue Feb 1 13:10:53 2011 +0100
Revert "get_server_capability() is defined twice in osad and rhncfg, merge and
move to rhnlib and make it member of rpclib.Server"
This reverts commit 7fd26bd46f506d416146485cb80ab0f11f298b5b.
reverting to stabilize sw1.3
we do not want to have server packages dependent on client-nightly repo
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index 05921e8..1f3b0c6 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -524,40 +524,6 @@ class Server:
self._transport.close()
self._transport = None
- def get_server_capability(self):
- """ Return dictionary of server capabilities.
-
- It is in form of:
- {{'registration.finish_message': {'version': '1',
'name': 'registration.finish_message', 'value': '1'},
...}
- """
- headers = self.get_response_headers()
- if headers is None:
- # No request done yet
- return {}
- cap_headers = headers.getallmatchingheaders("X-RHN-Server-Capability")
- if not cap_headers:
- return {}
- regexp = re.compile(
-
r"^(?P<name>[^(]*)\((?P<version>[^)]*)\)\s*=\s*(?P<value>.*)$")
- vals = {}
- for h in cap_headers:
- arr = string.split(h, ':', 1)
- assert len(arr) == 2
- val = string.strip(arr[1])
- if not val:
- continue
-
- mo = regexp.match(val)
- if not mo:
- # XXX Just ignoring it, for now
- continue
- vdict = mo.groupdict()
- for k, v in vdict.items():
- vdict[k] = string.strip(v)
-
- vals[vdict['name']] = vdict
- return vals
-
# RHN GET server
class GETServer(Server):
def __init__(self, uri, transport=None, proxy=None, username=None,
diff --git a/client/tools/osad/osad.spec b/client/tools/osad/osad.spec
index cbd0791..7c68e80 100644
--- a/client/tools/osad/osad.spec
+++ b/client/tools/osad/osad.spec
@@ -15,7 +15,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u}
-n)
BuildArch: noarch
BuildRequires: python-devel
Requires: python
-Requires: rhnlib >= 2.5.31
+Requires: rhnlib >= 1.8-3
Requires: jabberpy
%if 0%{?rhel} <= 5
Requires: python-hashlib
diff --git a/client/tools/osad/src/osad.py b/client/tools/osad/src/osad.py
index bd5fb9d..8e95f47 100644
--- a/client/tools/osad/src/osad.py
+++ b/client/tools/osad/src/osad.py
@@ -138,7 +138,7 @@ class Runner(jabber_lib.Runner):
s.add_trusted_cert(osa_ssl_cert)
s.registration.welcome_message()
- server_capabilities = s.get_server_capability()
+ server_capabilities = get_server_capability(s)
if not
server_capabilities.has_key('registration.register_osad'):
die("Server does not support OSAD registration")
@@ -370,5 +370,34 @@ class OldUp2dateConfig:
def __getitem__(self, name):
return self._config_obj.readEntry(name)
+def get_server_capability(s):
+ headers = s.get_response_headers()
+ if headers is None:
+ # No request done yet
+ return {}
+ cap_headers = headers.getallmatchingheaders("X-RHN-Server-Capability")
+ if not cap_headers:
+ return {}
+ regexp = re.compile(
+
r"^(?P<name>[^(]*)\((?P<version>[^)]*)\)\s*=\s*(?P<value>.*)$")
+ vals = {}
+ for h in cap_headers:
+ arr = string.split(h, ':', 1)
+ assert len(arr) == 2
+ val = string.strip(arr[1])
+ if not val:
+ continue
+
+ mo = regexp.match(val)
+ if not mo:
+ # XXX Just ignoring it, for now
+ continue
+ vdict = mo.groupdict()
+ for k, v in vdict.items():
+ vdict[k] = string.strip(v)
+
+ vals[vdict['name']] = vdict
+ return vals
+
if __name__ == '__main__':
sys.exit(main() or 0)
diff --git a/client/tools/rhncfg/config_common/repository.py
b/client/tools/rhncfg/config_common/repository.py
index 72dd92e..f11b45a 100644
--- a/client/tools/rhncfg/config_common/repository.py
+++ b/client/tools/rhncfg/config_common/repository.py
@@ -297,7 +297,7 @@ class RPC_Repository(Repository):
sys.stderr.write("XML-RPC error while talking to %s:\n %s\n" %
(self.__server_url, e))
sys.exit(2)
- self._server_capabilities = x_server.get_server_capability()
+ self._server_capabilities = get_server_capability(x_server)
del x_server
# 6/29/05 wregglej 152388
@@ -392,3 +392,32 @@ class RPC_Repository(Repository):
params['file_contents'] = file_contents
return params
+
+def get_server_capability(s):
+ headers = s.get_response_headers()
+ if headers is None:
+ # No request done yet
+ return {}
+ cap_headers = headers.getallmatchingheaders("X-RHN-Server-Capability")
+ if not cap_headers:
+ return {}
+ regexp = re.compile(
+
r"^(?P<name>[^(]*)\((?P<version>[^)]*)\)\s*=\s*(?P<value>.*)$")
+ vals = {}
+ for h in cap_headers:
+ arr = string.split(h, ':', 1)
+ assert len(arr) == 2
+ val = string.strip(arr[1])
+ if not val:
+ continue
+
+ mo = regexp.match(val)
+ if not mo:
+ # XXX Just ignoring it, for now
+ continue
+ vdict = mo.groupdict()
+ for k, v in vdict.items():
+ vdict[k] = string.strip(v)
+
+ vals[vdict['name']] = vdict
+ return vals
diff --git a/client/tools/rhncfg/rhncfg.spec b/client/tools/rhncfg/rhncfg.spec
index f8525c6..1618291 100644
--- a/client/tools/rhncfg/rhncfg.spec
+++ b/client/tools/rhncfg/rhncfg.spec
@@ -15,7 +15,7 @@ BuildArch: noarch
BuildRequires: docbook-utils
BuildRequires: python
Requires: python
-Requires: rhnlib >= 2.5.32
+Requires: rhnlib
# If this is rhel 4 or less we need up2date.
%if 0%{?rhel} && "%rhel" < "5"
Requires: up2date
diff --git a/client/tools/rhnpush/rhnpush.spec b/client/tools/rhnpush/rhnpush.spec
index 4c4ddf4..2d875bf 100644
--- a/client/tools/rhnpush/rhnpush.spec
+++ b/client/tools/rhnpush/rhnpush.spec
@@ -10,8 +10,7 @@ Release: 1%{?dist}
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
-Requires: rpm-python
-Requires: rhnlib >= 2.5.32
+Requires: rpm-python, rhnlib, rhncfg
Requires: spacewalk-backend-libs >= 0.8.3
%if 0%{?rhel} && 0%{?rhel} < 5
Requires: up2date
diff --git a/client/tools/rhnpush/uploadLib.py b/client/tools/rhnpush/uploadLib.py
index a69d0c4..7bc7e41 100644
--- a/client/tools/rhnpush/uploadLib.py
+++ b/client/tools/rhnpush/uploadLib.py
@@ -25,6 +25,8 @@ import struct
import xmlrpclib
from spacewalk.common import rhn_mpm
from spacewalk.common.checksum import getFileChecksum
+from config_common.repository import get_server_capability
+
try:
from up2date_client import rhnserver
rhnserver_available = True
@@ -725,7 +727,7 @@ def exists_getPackageChecksumBySession(rpc_server):
server._server = rpc_server
result =
server.capabilities.hasCapability('xmlrpc.packages.extended_profile', 2)
else: # rhel4 has no rhnserver
- server_capabilities = rpc_server.get_server_capability()
+ server_capabilities = get_server_capability(rpc_server)
if 'xmlrpc.packages.extended_profile' in server_capabilities:
# that capability can be '1' or '1-2', this is hackish
result =
server_capabilities['xmlrpc.packages.extended_profile']['version'] >
'1' and \