client/tools/rhnpush/rhnpush.spec | 4 ++++
client/tools/rhnpush/uploadLib.py | 21 ++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
New commits:
commit 7850cb478d0947f497c262e28792974c86806434
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Jan 25 13:16:13 2011 +0100
648403 - workaround missing hasCapability() on RHEL4
diff --git a/client/tools/rhnpush/rhnpush.spec b/client/tools/rhnpush/rhnpush.spec
index c52f32e..fe155ba 100644
--- a/client/tools/rhnpush/rhnpush.spec
+++ b/client/tools/rhnpush/rhnpush.spec
@@ -12,7 +12,11 @@ BuildRoot:
%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: rpm-python, rhnlib
Requires: spacewalk-backend-libs >= 0.8.3
+%if 0%{?rhel} && 0%{?rhel} <= 5
+Requires: up2date
+%else
Requires: rhn-client-tools
+%endif
BuildRequires: docbook-utils, gettext
Summary: Package uploader for the Red Hat Network Satellite Server
diff --git a/client/tools/rhnpush/uploadLib.py b/client/tools/rhnpush/uploadLib.py
index cb2cbbe..e43a0fc 100644
--- a/client/tools/rhnpush/uploadLib.py
+++ b/client/tools/rhnpush/uploadLib.py
@@ -710,6 +710,21 @@ def getServer(uri, proxy=None, username=None, password=None,
ca_chain=None):
s.add_trusted_cert(ca_chain)
return s
+def __hasCapability(self, capability, version=None):
+ """Checks if the server supports a capability and optionally a
version.
+ Returns True or False.
+ Copy from client/rhel/rhn-client-tools/src/up2date_client/capabilities.py
+ """
+ assert version is None or str(version).isdigit()
+
+ if not self.data.has_key(capability):
+ return False
+ if version:
+ data = self.data[capability]
+ if int(version) not in self.parseCapVersion(data['version']):
+ return False
+ return True
+
def exists_getPackageChecksumBySession(rpc_server):
""" check whether server supports getPackageChecksumBySession
function"""
# unfortunatelly we do not have capability for getPackageChecksumBySession function,
@@ -717,7 +732,11 @@ def exists_getPackageChecksumBySession(rpc_server):
# lets use it instead
server = rhnserver.RhnServer()
server._server = rpc_server
- return server.capabilities.hasCapability('xmlrpc.packages.extended_profile',
2)
+ try:
+ result =
server.capabilities.hasCapability('xmlrpc.packages.extended_profile', 2)
+ except AttributeError: # workaround for rhel4
+ result = __hasCapability(server.capabilities,
'xmlrpc.packages.extended_profile', 2)
+ return result
# compare two package [n,v,r,e] tuples
def packageCompare(pkg1, pkg2, is_mpm=None):
Show replies by date