client/rhel/rhnlib/rhn/rpclib.py | 34 ++++++++++++++++++ client/tools/osad/osad.spec | 2 - client/tools/osad/src/osad.py | 31 ---------------- client/tools/rhncfg/config_client/rhncfgcli_verify.py | 2 - client/tools/rhncfg/config_common/repository.py | 31 ---------------- client/tools/rhncfg/config_management/rhncfg_diff.py | 2 + client/tools/rhncfg/rhncfg.spec | 2 - client/tools/rhnpush/rhnpush.spec | 3 + client/tools/rhnpush/uploadLib.py | 23 ++++-------- 9 files changed, 51 insertions(+), 79 deletions(-)
New commits: commit afaee2003f50a60eac424f74880c714d9a6a8f85 Author: Miroslav Suchý msuchy@redhat.com Date: Mon Feb 7 14:17:30 2011 +0100
628920 - older Satellites do not send selinux_ctx
Addressing: Traceback (most recent call last): File "/usr/bin/rhncfg-manager", line 46, in ? sys.exit(Main().main() or 0) File "/usr/share/rhn/config_common/rhn_main.py", line 187, in main handler.run() File "/usr/share/rhn/config_management/rhncfg_diff.py", line 107, in run sys.stdout.write( File "/usr/share/rhn/config_management/rhncfg_diff.py", line 154, in diff_file if not first_row and not self.__attributes_differ(info, local_info): File "/usr/share/rhn/config_management/rhncfg_diff.py", line 114, in __attributes_differ return (fsrc['filemode'] != fdst['mode']) or \ KeyError: 'selinux_ctx'
and: Traceback (most recent call last): File "/usr/bin/rhncfg-manager", line 46, in ? sys.exit(Main().main() or 0) File "/usr/share/rhn/config_common/rhn_main.py", line 187, in main handler.run() File "/usr/share/rhn/config_management/rhncfg_diff.py", line 107, in run sys.stdout.write( File "/usr/share/rhn/config_management/rhncfg_diff.py", line 160, in diff_file first_row = template % (path, str(info['modified']), ostr_to_sym(info['filemode'], info['filetype']), KeyError: 'selinux_ctx'
diff --git a/client/tools/rhncfg/config_management/rhncfg_diff.py b/client/tools/rhncfg/config_management/rhncfg_diff.py index 1c14210..e5191c7 100644 --- a/client/tools/rhncfg/config_management/rhncfg_diff.py +++ b/client/tools/rhncfg/config_management/rhncfg_diff.py @@ -147,6 +147,8 @@ class Handler(handler_base.HandlerBase): # rhel4 do not support selinux if not 'selinux_ctx' in local_info: local_info['selinux_ctx'] = '' + if 'selinux_ctx' not in info: + info['selinux_ctx'] = '' if not first_row and not self.__attributes_differ(info, local_info): return "" else:
commit 47bc1d697b10cc271cdd22b28caaeca8c7380d7b Author: Miroslav Suchý msuchy@redhat.com Date: Mon Feb 7 14:03:13 2011 +0100
675164 - do not traceback if file do not differ
addressing: Traceback (most recent call last): File "/usr/bin/rhncfg-client", line 34, in ? sys.exit(Main().main() or 0) File "/usr/share/rhn/config_common/rhn_main.py", line 187, in main handler.run() File "/usr/share/rhn/config_client/rhncfgcli_verify.py", line 159, in run maxlen = max(map(lambda x: len(x['status']), ret)) + 1 ValueError: max() arg is an empty sequence
diff --git a/client/tools/rhncfg/config_client/rhncfgcli_verify.py b/client/tools/rhncfg/config_client/rhncfgcli_verify.py index 14a19a8..a86e1b7 100644 --- a/client/tools/rhncfg/config_client/rhncfgcli_verify.py +++ b/client/tools/rhncfg/config_client/rhncfgcli_verify.py @@ -156,7 +156,7 @@ class Handler(handler_base.HandlerBase): #Not verbose, so give the simple output for each file... else: outstring = "%*s %s" - maxlen = max(map(lambda x: len(x['status']), ret)) + 1 + maxlen = max(0, map(lambda x: len(x['status']), ret)) + 1 for fdict in ret: if self.options.only and len(fdict['status']) == 0: continue
commit ed599e8af41c3ab0f38c8aed2d0b1e8298676f22 Author: Miroslav Suchý msuchy@redhat.com Date: Mon Feb 7 09:54:15 2011 +0100
Revert "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 f3be803b4b0b6545811268911d24288aff774d39.
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py index 1f3b0c6..b2f4774 100644 --- a/client/rhel/rhnlib/rhn/rpclib.py +++ b/client/rhel/rhnlib/rhn/rpclib.py @@ -524,6 +524,40 @@ 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 5e6c9b4..28423a0 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 >= 1.8-3 +Requires: rhnlib >= 2.5.31 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 8e95f47..bd5fb9d 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 = get_server_capability(s) + server_capabilities = s.get_server_capability() if not server_capabilities.has_key('registration.register_osad'): die("Server does not support OSAD registration")
@@ -370,34 +370,5 @@ 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 f11b45a..72dd92e 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 = get_server_capability(x_server) + self._server_capabilities = x_server.get_server_capability() del x_server
# 6/29/05 wregglej 152388 @@ -392,32 +392,3 @@ 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 b5e8c6f..008c9fb 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 +Requires: rhnlib >= 2.5.32 # 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 2186130..d66cb9d 100644 --- a/client/tools/rhnpush/rhnpush.spec +++ b/client/tools/rhnpush/rhnpush.spec @@ -10,7 +10,8 @@ Release: 1%{?dist} Source0: https://fedorahosted.org/releases/s/p/spacewalk/%%7Bname%7D-%%7Bversion%7D.t... BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -Requires: rpm-python, rhnlib, rhncfg +Requires: rpm-python +Requires: rhnlib >= 2.5.32 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 7bc7e41..a69d0c4 100644 --- a/client/tools/rhnpush/uploadLib.py +++ b/client/tools/rhnpush/uploadLib.py @@ -25,8 +25,6 @@ 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 @@ -727,7 +725,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 = get_server_capability(rpc_server) + server_capabilities = rpc_server.get_server_capability() 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 \
commit 8535f49f9356b7a00a952d5a6261245cc7833d0e Author: Miroslav Suchý msuchy@redhat.com Date: Mon Feb 7 09:53:31 2011 +0100
Revert "Revert "648403 - do not create TB even on Red Hat Enterprise Linux 4""
This reverts commit b86ca4b9c50a83f489ab548d8a8abc66a6ad6a44.
diff --git a/client/tools/rhnpush/rhnpush.spec b/client/tools/rhnpush/rhnpush.spec index 7dcb30d..2186130 100644 --- a/client/tools/rhnpush/rhnpush.spec +++ b/client/tools/rhnpush/rhnpush.spec @@ -10,7 +10,7 @@ Release: 1%{?dist} Source0: https://fedorahosted.org/releases/s/p/spacewalk/%%7Bname%7D-%%7Bversion%7D.t... BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -Requires: rpm-python, rhnlib +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 a6e96ee..7bc7e41 100644 --- a/client/tools/rhnpush/uploadLib.py +++ b/client/tools/rhnpush/uploadLib.py @@ -15,6 +15,7 @@
# system imports import os +import re import sys import string import fnmatch @@ -24,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 @@ -724,21 +727,13 @@ def exists_getPackageChecksumBySession(rpc_server): server._server = rpc_server result = server.capabilities.hasCapability('xmlrpc.packages.extended_profile', 2) else: # rhel4 has no rhnserver - result = True - try: # if server do not have this function we will create TB :( - raw_call(rpc_server.packages.getPackageChecksumBySession, '', {}) - except xmlrpclib.Fault, e: - if e.faultCode in [-2, -33]: - # Fault -33: session token is invalid - # i.e. function exists but we supplied wrong data - # Fault -2 session is unknown - expected when empty - pass - elif e.faultCode == -1: - # Fault -1: function invalid - result = False - else: - # pass through anything else - raise + 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 \ + server_capabilities['xmlrpc.packages.extended_profile']['value'] # usually '1' + else: + result = False return result
# compare two package [n,v,r,e] tuples
spacewalk-commits@lists.fedorahosted.org