4 commits - backend/satellite_tools backend/server client/tools
by Michael Mraka
backend/satellite_tools/satsync.py | 14 +++++---------
backend/server/importlib/headerSource.py | 3 +++
backend/server/importlib/packageImport.py | 1 +
client/tools/rhnpush/rhnpush.py | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
New commits:
commit 74217fb47d937f2d34f5464269e78ae766a5bb83
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Jan 8 11:18:46 2010 +0100
fixed rhnpush errors (500 Internal Server Error)
diff --git a/backend/server/importlib/headerSource.py b/backend/server/importlib/headerSource.py
index c182088..2504bee 100644
--- a/backend/server/importlib/headerSource.py
+++ b/backend/server/importlib/headerSource.py
@@ -32,6 +32,9 @@ class rpmPackage(IncompletePackage):
tagMap = {
# Ignoring these tags
'last_modified' : None,
+ # We set them differently
+ 'checksum' : None,
+ 'checksum_type' : None,
}
def populate(self, header, size, checksum_type, checksum, path=None, org_id=None,
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index 0d1e0f0..33bf6c1 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -23,6 +23,7 @@ from importLib import GenericPackageImport, IncompletePackage, Package, \
IncompatibleArchError
from server import taskomatic
from common import CFG
+from types import StringType
class ChannelPackageSubscription(GenericPackageImport):
def __init__(self, batch, backend, caller=None, strict=0):
commit ba64a186454c161b6d26fcf3fd434c1e8d6d4ea0
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Jan 8 11:08:13 2010 +0100
md5sum vs. checksum is already handled by package class
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index a454b68..a100e31 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -1676,14 +1676,9 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# Populate the package key info
if len(self.pkg_header_info) > 0:
for data in self.pkg_header_info:
- if 'md5sum' in data: # old pre-sha256 package export
- checksum_type = 'md5'
- checksum = data['md5sum']
- else:
- checksum_type = data['checksum_type']
- checksum = data['checksum']
- server_packages.processPackageKeyAssociations(data['header'], \
- checksum_type, checksum)
+ server_packages.processPackageKeyAssociations(data['header'],
+ data['checksum_type'], data['checksum'])
+
return self._link_channel_packages()
def _link_channel_packages(self):
commit de9192435f60ae688c43c414c34aecf302b791ee
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Jan 8 10:50:55 2010 +0100
md5sum has changed to checksum
Traceback (most recent call last):
File "/usr/bin/satellite-sync", line 142, in main
return satsync.Runner().main()
File "/usr/share/rhn/satellite_tools/satsync.py", line 215, in main
ret = method()
File "/usr/share/rhn/satellite_tools/satsync.py", line 317, in _step_rpms
self._packages_report = self.syncer.download_rpms()
File "/usr/share/rhn/satellite_tools/satsync.py", line 1035, in download_rpms
self._fetch_packages(channel, missing_fs_packages)
File "/usr/share/rhn/satellite_tools/satsync.py", line 1902, in _fetch_packages
self.pkg_header_info.append({'header' : hdr,
File "/usr/lib64/python2.4/UserDict.py", line 17, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 'md5sum'
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index 979b7ba..a454b68 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -1896,7 +1896,8 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
hdr = rhn_rpm.get_package_header(filename=rpmManip.full_path)
self.pkg_header_info.append({'header' : hdr,
- 'md5sum' : package['md5sum'] })
+ 'checksum_type' : package['checksum_type'],
+ 'checksum' : package['checksum']})
log(1, messages.package_fetch_successful %
(pkg_current, pkgs_total, filename, size))
commit f4ecce86c0914d0643faa5d4f403e763f67e793f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jan 7 18:38:04 2010 +0100
need also to initialize checksum_type and checksum
diff --git a/client/tools/rhnpush/rhnpush.py b/client/tools/rhnpush/rhnpush.py
index a9c1f4c..9a480d7 100755
--- a/client/tools/rhnpush/rhnpush.py
+++ b/client/tools/rhnpush/rhnpush.py
@@ -348,7 +348,7 @@ class UploadClass(uploadLib.UploadClass):
if not server_digest_hash.has_key(pkg_key):
continue
- digest = digest_hash[pkg_key]
+ checksum_type, checksum = digest = digest_hash[pkg_key]
server_digest = tuple(server_digest_hash[pkg_key])
# compare checksums for existance check
14 years, 3 months
12 commits - backend/apache-conf backend/common backend/httpd-conf backend/satellite_exporter backend/server backend/spacewalk-backend.spec backend/upload_server
by Justin Sherrill
backend/apache-conf/zz-spacewalk-server-python.conf | 28 ++
backend/apache-conf/zz-spacewalk-server-wsgi.conf | 17 +
backend/apache-conf/zz-spacewalk-server.conf | 16 -
backend/common/__init__.py | 2
backend/common/rhnApache.py | 2
backend/httpd-conf/rhn/app.conf | 1
backend/httpd-conf/rhn/applet.conf | 2
backend/httpd-conf/rhn/config-management-tool.conf | 2
backend/httpd-conf/rhn/config-management.conf | 2
backend/httpd-conf/rhn/package-push.conf | 2
backend/httpd-conf/rhn/pkg-upload.conf | 2
backend/httpd-conf/rhn/sat-export-internal.conf | 2
backend/httpd-conf/rhn/sat.conf | 2
backend/httpd-conf/rhn/xmlrpc.conf | 2
backend/httpd-conf/rhn/xp.conf | 2
backend/satellite_exporter/satexport.py | 4
backend/server/apache.py | 68 +++++++
backend/server/apacheHandler.py | 2
backend/server/apacheRequest.py | 2
backend/server/apacheServer.py | 2
backend/server/apacheUploadServer.py | 2
backend/server/basePackageUpload.py | 2
backend/server/wsgi/__init__.py | 16 +
backend/server/wsgi/app.py | 20 ++
backend/server/wsgi/applet.py | 20 ++
backend/server/wsgi/config.py | 20 ++
backend/server/wsgi/config_tool.py | 20 ++
backend/server/wsgi/package_push.py | 20 ++
backend/server/wsgi/package_upload.py | 20 ++
backend/server/wsgi/sat.py | 21 ++
backend/server/wsgi/sat_dump.py | 20 ++
backend/server/wsgi/wsgiHandler.py | 78 ++++++++
backend/server/wsgi/wsgiRequest.py | 97 ++++++++++
backend/server/wsgi/xmlrpc.py | 22 ++
backend/server/wsgi/xp.py | 21 ++
backend/spacewalk-backend.spec | 22 ++
backend/upload_server/handlers/package_push/package_push.py | 2
backend/upload_server/handlers/package_upload/package_upload.py | 2
38 files changed, 560 insertions(+), 27 deletions(-)
New commits:
commit 2775ac4478d917ccd6ca30da138c78923a996949
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Jan 7 17:37:34 2010 -0500
changing err_headers_out to use a custom Dict object
diff --git a/backend/server/wsgi/wsgiRequest.py b/backend/server/wsgi/wsgiRequest.py
index 81647b6..5b042ef 100644
--- a/backend/server/wsgi/wsgiRequest.py
+++ b/backend/server/wsgi/wsgiRequest.py
@@ -37,7 +37,7 @@ class WsgiRequest:
self.content_type = ""
self.the_request = env['REQUEST_METHOD'] + " " + env['SCRIPT_NAME'] + " " + env['SERVER_PROTOCOL']
self.output = []
- self.err_headers_out = []
+ self.err_headers_out = WsgiDict()
self.status = ""
self.sent_bodyct = 0
self.sent_header = 0
commit 74a15278b183d4772d94601ddf57c467643413c3
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Jan 7 17:14:34 2010 -0500
fixing logic check for determining rhel version
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 2c929b9..04b4d09 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -53,7 +53,7 @@ Requires: PyPAM
Obsoletes: rhns-server < 5.3.0
Provides: rhns-server = %{version}-%{release}
-%if 0%{?rhel} && 0%{?rhel} < 6
+%if 0%{?rhel} < 6
Requires: mod_python
%else
Requires: mod_wsgi
@@ -258,7 +258,7 @@ export PYTHON_MODULE_NAME=%{name}
export PYTHON_MODULE_VERSION=%{version}
%{__python} setup.py install -O1 --root $RPM_BUILD_ROOT --prefix=%{_prefix}
-%if 0%{?rhel} && 0%{?rhel} < 6
+%if 0%{?rhel} < 6
rm $RPM_BUILD_ROOT/%{apacheconfd}/zz-spacewalk-server-wsgi.conf
%else
rm $RPM_BUILD_ROOT/%{apacheconfd}/zz-spacewalk-server-python.conf
@@ -399,7 +399,7 @@ rm -f %{rhnconf}/rhnSecret.py*
# main httpd config
%attr(640,root,apache) %config %{apacheconfd}/zz-spacewalk-server.conf
-%if 0%{?rhel} && 0%{?rhel} < 6
+%if 0%{?rhel} < 6
%attr(640,root,apache) %config %{apacheconfd}/zz-spacewalk-server-python.conf
%else
%attr(640,root,apache) %config %{apacheconfd}/zz-spacewalk-server-wsgi.conf
commit de206c114180f2f878214a3ac08f3a086e52091e
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Jan 7 16:31:35 2010 -0500
fixing import from moved code
diff --git a/backend/satellite_exporter/satexport.py b/backend/satellite_exporter/satexport.py
index d1e8a6d..8299f02 100644
--- a/backend/satellite_exporter/satexport.py
+++ b/backend/satellite_exporter/satexport.py
@@ -22,7 +22,7 @@ from common import CFG, initCFG, log_debug, log_error, log_setreq, initLOG, \
Traceback, rhnFault, rhnException, rhnFlags
from common.rhnTranslate import _
from server import rhnSQL, rhnImport
-from satellite_exporter.exporter.dumper import ClosedConnectionError
+from satellite_tools.disk_dumper.dumper import ClosedConnectionError
from satellite_exporter import constants
class BaseApacheServer:
commit 3ccea48471309054d511e9baae596b388e16169d
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Jan 7 15:57:10 2010 -0500
removing duplicate mod_python requirement
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 280c818..2c929b9 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -49,7 +49,6 @@ backend modules.
Summary: Basic code that provides RHN Server functionality
Group: Applications/Internet
Requires(pre): %{name}-sql = %{version}-%{release}
-Requires: mod_python
Requires: PyPAM
Obsoletes: rhns-server < 5.3.0
Provides: rhns-server = %{version}-%{release}
commit 2c0e1f1c07d6319994e64c21abd4e0e69da29f16
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Jan 7 15:19:18 2010 -0500
fixing small mistake in config
diff --git a/backend/apache-conf/zz-spacewalk-server.conf b/backend/apache-conf/zz-spacewalk-server.conf
index b960292..55ae3e2 100644
--- a/backend/apache-conf/zz-spacewalk-server.conf
+++ b/backend/apache-conf/zz-spacewalk-server.conf
@@ -38,4 +38,5 @@ MaxClients 256
MaxRequestsPerChild 200
</IfModule>
-/etc/rhn/satellite-httpd/conf/rhn/rhn_monitoring.conf
+Include /etc/rhn/satellite-httpd/conf/rhn/rhn_monitoring.conf
+
commit 5137d01db3c5dc363fdce30c49a53636d1cb0eea
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Jan 7 15:14:18 2010 -0500
rearranging some config options
diff --git a/backend/apache-conf/zz-spacewalk-server-python.conf b/backend/apache-conf/zz-spacewalk-server-python.conf
index a0249da..3690c02 100644
--- a/backend/apache-conf/zz-spacewalk-server-python.conf
+++ b/backend/apache-conf/zz-spacewalk-server-python.conf
@@ -13,4 +13,16 @@ PythonInterpreter rhn.server
# This one shall be common for all the python configlets
PythonOption RootDir /usr/share/rhn
-Include /etc/rhn/satellite-httpd/conf/rhn/*.conf
+
+Include /etc/rhn/satellite-httpd/conf/rhn/app.conf
+Include /etc/rhn/satellite-httpd/conf/rhn/applet.conf
+Include /etc/rhn/satellite-httpd/conf/rhn/config-management.conf
+Include /etc/rhn/satellite-httpd/conf/rhn/config-management-tool.conf
+Include /etc/rhn/satellite-httpd/conf/rhn/package-push.conf
+Include /etc/rhn/satellite-httpd/conf/rhn/pkg-upload.conf
+Include /etc/rhn/satellite-httpd/conf/rhn/sat.conf
+Include /etc/rhn/satellite-httpd/conf/rhn/sat-export-internal.conf
+Include /etc/rhn/satellite-httpd/conf/rhn/xmlrpc.conf
+Include /etc/rhn/satellite-httpd/conf/rhn/xp.conf
+
+
diff --git a/backend/apache-conf/zz-spacewalk-server-wsgi.conf b/backend/apache-conf/zz-spacewalk-server-wsgi.conf
index dca0b41..5119cf9 100644
--- a/backend/apache-conf/zz-spacewalk-server-wsgi.conf
+++ b/backend/apache-conf/zz-spacewalk-server-wsgi.conf
@@ -3,5 +3,15 @@
</IfModule>
WSGIPythonPath "/usr/share/rhn"
-Include /etc/rhn/satellite-httpd/conf/rhn/*.conf
+
+WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/app.py
+WSGIScriptAlias /APPLET /usr/share/rhn/server/wsgi/applet.py
+WSGIScriptAlias /CONFIG-MANAGEMENT /usr/share/rhn/server/wsgi/config.py
+WSGIScriptAlias /CONFIG-MANAGEMENT-TOOL /usr/share/rhn/server/wsgi/config_tool.py
+WSGIScriptAlias /PACKAGE-PUSH /usr/share/rhn/server/wsgi/package_push.py
+WSGIScriptAlias /PKG-UPLOAD /usr/share/rhn/server/wsgi/package_upload.py
+WSGIScriptAlias /SAT /usr/share/rhn/server/wsgi/sat.py
+WSGIScriptAlias /SAT-DUMP-INTERNAL /usr/share/rhn/server/wsgi/sat_dump.py
+WSGIScriptAlias /XMLRPC /usr/share/rhn/server/wsgi/xmlrpc.py
+WSGIScriptAlias /XP /usr/share/rhn/server/wsgi/xp.py
diff --git a/backend/apache-conf/zz-spacewalk-server.conf b/backend/apache-conf/zz-spacewalk-server.conf
index 20d4e6d..b960292 100644
--- a/backend/apache-conf/zz-spacewalk-server.conf
+++ b/backend/apache-conf/zz-spacewalk-server.conf
@@ -38,3 +38,4 @@ MaxClients 256
MaxRequestsPerChild 200
</IfModule>
+/etc/rhn/satellite-httpd/conf/rhn/rhn_monitoring.conf
diff --git a/backend/httpd-conf/rhn/app.conf b/backend/httpd-conf/rhn/app.conf
index e7bbac4..78b3221 100644
--- a/backend/httpd-conf/rhn/app.conf
+++ b/backend/httpd-conf/rhn/app.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule !wsgi_module>
+<IfModule mod_python.c>
<Location /APP>
SetHandler python-program
@@ -22,6 +22,3 @@
</IfModule>
-<IfModule wsgi_module>
- WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/app.py
-</IfModule>
diff --git a/backend/httpd-conf/rhn/applet.conf b/backend/httpd-conf/rhn/applet.conf
index 923cacc..4a6cf7d 100644
--- a/backend/httpd-conf/rhn/applet.conf
+++ b/backend/httpd-conf/rhn/applet.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule !wsgi_module>
+<IfModule mod_python.c>
<Location /APPLET>
SetHandler python-program
@@ -22,7 +22,4 @@
</IfModule>
-<IfModule wsgi_module>
- WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/applet.py
-</IfModule>
diff --git a/backend/httpd-conf/rhn/config-management-tool.conf b/backend/httpd-conf/rhn/config-management-tool.conf
index 12feb00..f3107a3 100644
--- a/backend/httpd-conf/rhn/config-management-tool.conf
+++ b/backend/httpd-conf/rhn/config-management-tool.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule !wsgi_module>
+<IfModule mod_python.c>
<Location /CONFIG-MANAGEMENT-TOOL>
SetHandler python-program
@@ -22,7 +22,4 @@
</IfModule>
-<IfModule wsgi_module>
- WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/config_tool.py
-</IfModule>
diff --git a/backend/httpd-conf/rhn/config-management.conf b/backend/httpd-conf/rhn/config-management.conf
index f541b4a..349673d 100644
--- a/backend/httpd-conf/rhn/config-management.conf
+++ b/backend/httpd-conf/rhn/config-management.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule !wsgi_module>
+<IfModule mod_python.c>
<Location /CONFIG-MANAGEMENT>
SetHandler python-program
@@ -22,7 +22,4 @@
</IfModule>
-<IfModule wsgi_module>
- WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/config.py
-</IfModule>
diff --git a/backend/httpd-conf/rhn/package-push.conf b/backend/httpd-conf/rhn/package-push.conf
index e63e337..ce9b602 100644
--- a/backend/httpd-conf/rhn/package-push.conf
+++ b/backend/httpd-conf/rhn/package-push.conf
@@ -1,5 +1,5 @@
# ** DO NOT EDIT **
-<IfModule !wsgi_module>
+<IfModule mod_python.c>
<Location /PACKAGE-PUSH>
SetHandler python-program
@@ -20,7 +20,4 @@
</IfModule>
-<IfModule wsgi_module>
- WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/package_push.py
-</IfModule>
diff --git a/backend/httpd-conf/rhn/pkg-upload.conf b/backend/httpd-conf/rhn/pkg-upload.conf
index dd340ad..a2b9b2e 100644
--- a/backend/httpd-conf/rhn/pkg-upload.conf
+++ b/backend/httpd-conf/rhn/pkg-upload.conf
@@ -1,5 +1,5 @@
# ** DO NOT EDIT **
-<IfModule !wsgi_module>
+<IfModule mod_python.c>
<Location /PKG-UPLOAD>
SetHandler python-program
@@ -20,7 +20,4 @@
</IfModule>
-<IfModule wsgi_module>
- WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/package_upload.py
-</IfModule>
diff --git a/backend/httpd-conf/rhn/sat-export-internal.conf b/backend/httpd-conf/rhn/sat-export-internal.conf
index 6652f12..bfc7256 100644
--- a/backend/httpd-conf/rhn/sat-export-internal.conf
+++ b/backend/httpd-conf/rhn/sat-export-internal.conf
@@ -1,5 +1,5 @@
# ** DO NOT EDIT **
-<IfModule !wsgi_module>
+<IfModule mod_python.c>
<Location /SAT-DUMP-INTERNAL>
SetHandler python-program
@@ -14,7 +14,3 @@
</IfModule>
-<IfModule wsgi_module>
- WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/sat_dump.py
-</IfModule>
-
diff --git a/backend/httpd-conf/rhn/sat.conf b/backend/httpd-conf/rhn/sat.conf
index f6ab178..cbad6c7 100644
--- a/backend/httpd-conf/rhn/sat.conf
+++ b/backend/httpd-conf/rhn/sat.conf
@@ -2,7 +2,7 @@
# Configuration for the /SAT handler
#
-<IfModule !wsgi_module>
+<IfModule mod_python.c>
<Location /SAT>
SetHandler python-program
@@ -21,7 +21,4 @@
</IfModule>
-<IfModule wsgi_module>
- WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/sat.py
-</IfModule>
diff --git a/backend/httpd-conf/rhn/xmlrpc.conf b/backend/httpd-conf/rhn/xmlrpc.conf
index 3d30a17..9e5b12b 100644
--- a/backend/httpd-conf/rhn/xmlrpc.conf
+++ b/backend/httpd-conf/rhn/xmlrpc.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule !wsgi_module>
+<IfModule mod_python.c>
<Location /XMLRPC>
SetHandler python-program
@@ -22,7 +22,4 @@
</IfModule>
-<IfModule wsgi_module>
- WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/xmlrpc.py
-</IfModule>
diff --git a/backend/httpd-conf/rhn/xp.conf b/backend/httpd-conf/rhn/xp.conf
index 39d6bf7..3fe0ab8 100644
--- a/backend/httpd-conf/rhn/xp.conf
+++ b/backend/httpd-conf/rhn/xp.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule !wsgi_module>
+<IfModule mod_python.c>
<Location /XP>
SetHandler python-program
@@ -22,7 +22,4 @@
</IfModule>
-<IModule wsgi_module>
- WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/xp.py
-</IfModule>
commit 61ec9063b88d73fcddf26994507bb6e43d1ae475
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Jan 7 14:48:17 2010 -0500
fixing small mistake in spec file
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 2d32ee5..280c818 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -260,9 +260,9 @@ export PYTHON_MODULE_VERSION=%{version}
%{__python} setup.py install -O1 --root $RPM_BUILD_ROOT --prefix=%{_prefix}
%if 0%{?rhel} && 0%{?rhel} < 6
-rm %{apacheconfd}/zz-spacewalk-server-wsgi.conf
+rm $RPM_BUILD_ROOT/%{apacheconfd}/zz-spacewalk-server-wsgi.conf
%else
-rm %{apacheconfd}/zz-spacewalk-server-python.conf
+rm $RPM_BUILD_ROOT/%{apacheconfd}/zz-spacewalk-server-python.conf
%endif
commit 3a7882742082a833333bbc8bf40b3983a70023e9
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Jan 7 14:44:14 2010 -0500
fixing small mistake in spec file
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index dcd9de4..2d32ee5 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -260,9 +260,9 @@ export PYTHON_MODULE_VERSION=%{version}
%{__python} setup.py install -O1 --root $RPM_BUILD_ROOT --prefix=%{_prefix}
%if 0%{?rhel} && 0%{?rhel} < 6
-rm %config %{apacheconfd}/zz-spacewalk-server-wsgi.conf
+rm %{apacheconfd}/zz-spacewalk-server-wsgi.conf
%else
-rm %config %{apacheconfd}/zz-spacewalk-server-python.conf
+rm %{apacheconfd}/zz-spacewalk-server-python.conf
%endif
commit 708d06b93ca12655ade79949d4796bddf153ae56
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Jan 7 14:38:59 2010 -0500
removing the python handler config file not needed
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 33dd38f..dcd9de4 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -259,6 +259,13 @@ export PYTHON_MODULE_NAME=%{name}
export PYTHON_MODULE_VERSION=%{version}
%{__python} setup.py install -O1 --root $RPM_BUILD_ROOT --prefix=%{_prefix}
+%if 0%{?rhel} && 0%{?rhel} < 6
+rm %config %{apacheconfd}/zz-spacewalk-server-wsgi.conf
+%else
+rm %config %{apacheconfd}/zz-spacewalk-server-python.conf
+%endif
+
+
%clean
rm -rf $RPM_BUILD_ROOT
commit c37bd23470036f39c2d64a1573864eec10ae4f6e
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Jan 6 18:07:10 2010 -0500
adding module specific config files
diff --git a/backend/apache-conf/zz-spacewalk-server-python.conf b/backend/apache-conf/zz-spacewalk-server-python.conf
new file mode 100644
index 0000000..a0249da
--- /dev/null
+++ b/backend/apache-conf/zz-spacewalk-server-python.conf
@@ -0,0 +1,16 @@
+<IfModule !mod_python.c>
+LoadModule python_module modules/mod_python.so
+AddModule mod_python.c
+</IfModule>
+
+PythonPath "sys.path+['/usr/share/rhn']"
+PythonDebug Off
+
+
+# Name the default python subiterpreter
+PythonInterpreter rhn.server
+
+# This one shall be common for all the python configlets
+PythonOption RootDir /usr/share/rhn
+
+Include /etc/rhn/satellite-httpd/conf/rhn/*.conf
diff --git a/backend/apache-conf/zz-spacewalk-server-wsgi.conf b/backend/apache-conf/zz-spacewalk-server-wsgi.conf
new file mode 100644
index 0000000..dca0b41
--- /dev/null
+++ b/backend/apache-conf/zz-spacewalk-server-wsgi.conf
@@ -0,0 +1,7 @@
+<IfModule !wsgi_module>
+ LoadModule wsgi_module modules/mod_wsgi.so
+</IfModule>
+
+WSGIPythonPath "/usr/share/rhn"
+Include /etc/rhn/satellite-httpd/conf/rhn/*.conf
+
commit 0bfb0def195e9b4b73677dc76e45e1344ed5ed97
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Jan 6 17:35:36 2010 -0500
changing config files to support wsgi for rhel > 5 or fedora
diff --git a/backend/apache-conf/zz-spacewalk-server.conf b/backend/apache-conf/zz-spacewalk-server.conf
index 0d45d9d..20d4e6d 100644
--- a/backend/apache-conf/zz-spacewalk-server.conf
+++ b/backend/apache-conf/zz-spacewalk-server.conf
@@ -38,19 +38,3 @@ MaxClients 256
MaxRequestsPerChild 200
</IfModule>
-# MOD_PYTHON
-<IfModule !mod_python.c>
-LoadModule python_module modules/mod_python.so
-AddModule mod_python.c
-</IfModule>
-
-PythonPath "sys.path+['/usr/share/rhn']"
-PythonDebug Off
-# Name the default python subiterpreter
-PythonInterpreter rhn.server
-
-# This one shall be common for all the python configlets
-PythonOption RootDir /usr/share/rhn
-
-# And now include the configlets we need
-Include /etc/rhn/satellite-httpd/conf/rhn/*.conf
diff --git a/backend/httpd-conf/rhn/app.conf b/backend/httpd-conf/rhn/app.conf
index ca046ac..e7bbac4 100644
--- a/backend/httpd-conf/rhn/app.conf
+++ b/backend/httpd-conf/rhn/app.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule mod_python.c>
+<IfModule !wsgi_module>
<Location /APP>
SetHandler python-program
@@ -21,3 +21,7 @@
</Location>
</IfModule>
+
+<IfModule wsgi_module>
+ WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/app.py
+</IfModule>
diff --git a/backend/httpd-conf/rhn/applet.conf b/backend/httpd-conf/rhn/applet.conf
index e800a83..923cacc 100644
--- a/backend/httpd-conf/rhn/applet.conf
+++ b/backend/httpd-conf/rhn/applet.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule mod_python.c>
+<IfModule !wsgi_module>
<Location /APPLET>
SetHandler python-program
@@ -21,3 +21,8 @@
</Location>
</IfModule>
+
+<IfModule wsgi_module>
+ WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/applet.py
+</IfModule>
+
diff --git a/backend/httpd-conf/rhn/config-management-tool.conf b/backend/httpd-conf/rhn/config-management-tool.conf
index ffa4866..12feb00 100644
--- a/backend/httpd-conf/rhn/config-management-tool.conf
+++ b/backend/httpd-conf/rhn/config-management-tool.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule mod_python.c>
+<IfModule !wsgi_module>
<Location /CONFIG-MANAGEMENT-TOOL>
SetHandler python-program
@@ -21,3 +21,8 @@
</Location>
</IfModule>
+
+<IfModule wsgi_module>
+ WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/config_tool.py
+</IfModule>
+
diff --git a/backend/httpd-conf/rhn/config-management.conf b/backend/httpd-conf/rhn/config-management.conf
index bb0ae7c..f541b4a 100644
--- a/backend/httpd-conf/rhn/config-management.conf
+++ b/backend/httpd-conf/rhn/config-management.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule mod_python.c>
+<IfModule !wsgi_module>
<Location /CONFIG-MANAGEMENT>
SetHandler python-program
@@ -21,3 +21,8 @@
</Location>
</IfModule>
+
+<IfModule wsgi_module>
+ WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/config.py
+</IfModule>
+
diff --git a/backend/httpd-conf/rhn/package-push.conf b/backend/httpd-conf/rhn/package-push.conf
index 406216d..e63e337 100644
--- a/backend/httpd-conf/rhn/package-push.conf
+++ b/backend/httpd-conf/rhn/package-push.conf
@@ -1,5 +1,5 @@
# ** DO NOT EDIT **
-<IfModule mod_python.c>
+<IfModule !wsgi_module>
<Location /PACKAGE-PUSH>
SetHandler python-program
@@ -19,3 +19,8 @@
</Location>
</IfModule>
+
+<IfModule wsgi_module>
+ WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/package_push.py
+</IfModule>
+
diff --git a/backend/httpd-conf/rhn/pkg-upload.conf b/backend/httpd-conf/rhn/pkg-upload.conf
index 0a59f90..dd340ad 100644
--- a/backend/httpd-conf/rhn/pkg-upload.conf
+++ b/backend/httpd-conf/rhn/pkg-upload.conf
@@ -1,5 +1,5 @@
# ** DO NOT EDIT **
-<IfModule mod_python.c>
+<IfModule !wsgi_module>
<Location /PKG-UPLOAD>
SetHandler python-program
@@ -19,3 +19,8 @@
</Location>
</IfModule>
+
+<IfModule wsgi_module>
+ WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/package_upload.py
+</IfModule>
+
diff --git a/backend/httpd-conf/rhn/sat-export-internal.conf b/backend/httpd-conf/rhn/sat-export-internal.conf
index ef05414..6652f12 100644
--- a/backend/httpd-conf/rhn/sat-export-internal.conf
+++ b/backend/httpd-conf/rhn/sat-export-internal.conf
@@ -1,5 +1,5 @@
# ** DO NOT EDIT **
-<IfModule mod_python.c>
+<IfModule !wsgi_module>
<Location /SAT-DUMP-INTERNAL>
SetHandler python-program
@@ -12,3 +12,9 @@
</Location>
</IfModule>
+
+
+<IfModule wsgi_module>
+ WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/sat_dump.py
+</IfModule>
+
diff --git a/backend/httpd-conf/rhn/sat.conf b/backend/httpd-conf/rhn/sat.conf
index ba7ce0e..f6ab178 100644
--- a/backend/httpd-conf/rhn/sat.conf
+++ b/backend/httpd-conf/rhn/sat.conf
@@ -2,7 +2,7 @@
# Configuration for the /SAT handler
#
-<IfModule mod_python.c>
+<IfModule !wsgi_module>
<Location /SAT>
SetHandler python-program
@@ -20,3 +20,8 @@
</Location>
</IfModule>
+
+<IfModule wsgi_module>
+ WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/sat.py
+</IfModule>
+
diff --git a/backend/httpd-conf/rhn/xmlrpc.conf b/backend/httpd-conf/rhn/xmlrpc.conf
index 039f90c..3d30a17 100644
--- a/backend/httpd-conf/rhn/xmlrpc.conf
+++ b/backend/httpd-conf/rhn/xmlrpc.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule mod_python.c>
+<IfModule !wsgi_module>
<Location /XMLRPC>
SetHandler python-program
@@ -21,3 +21,8 @@
</Location>
</IfModule>
+
+<IfModule wsgi_module>
+ WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/xmlrpc.py
+</IfModule>
+
diff --git a/backend/httpd-conf/rhn/xp.conf b/backend/httpd-conf/rhn/xp.conf
index 39d41ae..39d6bf7 100644
--- a/backend/httpd-conf/rhn/xp.conf
+++ b/backend/httpd-conf/rhn/xp.conf
@@ -3,7 +3,7 @@
#
# $Id$
-<IfModule mod_python.c>
+<IfModule !wsgi_module>
<Location /XP>
SetHandler python-program
@@ -21,3 +21,8 @@
</Location>
</IfModule>
+
+<IModule wsgi_module>
+ WSGIScriptAlias /APP /usr/share/rhn/server/wsgi/xp.py
+</IfModule>
+
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 3750640..33dd38f 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -54,6 +54,13 @@ Requires: PyPAM
Obsoletes: rhns-server < 5.3.0
Provides: rhns-server = %{version}-%{release}
+%if 0%{?rhel} && 0%{?rhel} < 6
+Requires: mod_python
+%else
+Requires: mod_wsgi
+%endif
+
+
%description server
This package contains the basic code that provides server/backend
functionality for a variety of XML-RPC receivers. The architecture is
@@ -385,6 +392,13 @@ rm -f %{rhnconf}/rhnSecret.py*
%attr(640,root,apache) %{rhnconf}/default/rhn_server.conf
# main httpd config
%attr(640,root,apache) %config %{apacheconfd}/zz-spacewalk-server.conf
+
+%if 0%{?rhel} && 0%{?rhel} < 6
+%attr(640,root,apache) %config %{apacheconfd}/zz-spacewalk-server-python.conf
+%else
+%attr(640,root,apache) %config %{apacheconfd}/zz-spacewalk-server-wsgi.conf
+%endif
+
# logs and other stuff
%config %{_sysconfdir}/logrotate.d/rhn_server
# translations
commit 7d05c99a080951a4c055648f6cd9ab4eae74c5ef
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Jan 6 14:32:21 2010 -0500
adding wsgi support adapter and removing code dependence on mod_python
diff --git a/backend/common/__init__.py b/backend/common/__init__.py
index 5186e33..ce89ca8 100644
--- a/backend/common/__init__.py
+++ b/backend/common/__init__.py
@@ -25,8 +25,8 @@ from rhnConfig import CFG, initCFG
# try to figure out if we're running under Apache or not
try:
- import _apache
from rhnApache import rhnApache
+ import _apache
except ImportError:
# no _apache available, not running under apache/mod_python
pass
diff --git a/backend/common/rhnApache.py b/backend/common/rhnApache.py
index 6fb16f3..db4f926 100644
--- a/backend/common/rhnApache.py
+++ b/backend/common/rhnApache.py
@@ -23,7 +23,7 @@ import os.path
# global module imports
-from mod_python import apache
+from server import apache
# Now local module imports
diff --git a/backend/satellite_exporter/satexport.py b/backend/satellite_exporter/satexport.py
index 015f0a7..d1e8a6d 100644
--- a/backend/satellite_exporter/satexport.py
+++ b/backend/satellite_exporter/satexport.py
@@ -16,7 +16,7 @@
import time
import xmlrpclib
-from mod_python import apache
+from server import apache
from common import CFG, initCFG, log_debug, log_error, log_setreq, initLOG, \
Traceback, rhnFault, rhnException, rhnFlags
diff --git a/backend/server/apache.py b/backend/server/apache.py
new file mode 100644
index 0000000..79b687f
--- /dev/null
+++ b/backend/server/apache.py
@@ -0,0 +1,68 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+# constants meant to match the apache.py module of mod_python
+
+HTTP_CONTINUE = 100
+HTTP_SWITCHING_PROTOCOLS = 101
+HTTP_PROCESSING = 102
+HTTP_OK = 200
+HTTP_CREATED = 201
+HTTP_ACCEPTED = 202
+HTTP_NON_AUTHORITATIVE = 203
+HTTP_NO_CONTENT = 204
+HTTP_RESET_CONTENT = 205
+HTTP_PARTIAL_CONTENT = 206
+HTTP_MULTI_STATUS = 207
+HTTP_MULTIPLE_CHOICES = 300
+HTTP_MOVED_PERMANENTLY = 301
+HTTP_MOVED_TEMPORARILY = 302
+HTTP_SEE_OTHER = 303
+HTTP_NOT_MODIFIED = 304
+HTTP_USE_PROXY = 305
+HTTP_TEMPORARY_REDIRECT = 307
+HTTP_BAD_REQUEST = 400
+HTTP_UNAUTHORIZED = 401
+HTTP_PAYMENT_REQUIRED = 402
+HTTP_FORBIDDEN = 403
+HTTP_NOT_FOUND = 404
+HTTP_METHOD_NOT_ALLOWED = 405
+HTTP_NOT_ACCEPTABLE = 406
+HTTP_PROXY_AUTHENTICATION_REQUIRED= 407
+HTTP_REQUEST_TIME_OUT = 408
+HTTP_CONFLICT = 409
+HTTP_GONE = 410
+HTTP_LENGTH_REQUIRED = 411
+HTTP_PRECONDITION_FAILED = 412
+HTTP_REQUEST_ENTITY_TOO_LARGE = 413
+HTTP_REQUEST_URI_TOO_LARGE = 414
+HTTP_UNSUPPORTED_MEDIA_TYPE = 415
+HTTP_RANGE_NOT_SATISFIABLE = 416
+HTTP_EXPECTATION_FAILED = 417
+HTTP_UNPROCESSABLE_ENTITY = 422
+HTTP_LOCKED = 423
+HTTP_FAILED_DEPENDENCY = 424
+HTTP_INTERNAL_SERVER_ERROR = 500
+HTTP_NOT_IMPLEMENTED = 501
+HTTP_BAD_GATEWAY = 502
+HTTP_SERVICE_UNAVAILABLE = 503
+HTTP_GATEWAY_TIME_OUT = 504
+HTTP_VERSION_NOT_SUPPORTED = 505
+HTTP_VARIANT_ALSO_VARIES = 506
+HTTP_INSUFFICIENT_STORAGE = 507
+HTTP_NOT_EXTENDED = 510
+REMOTE_DOUBLE_REV = 3
+OK = REQ_PROCEED = 0
diff --git a/backend/server/apacheHandler.py b/backend/server/apacheHandler.py
index ae15436..012fa39 100644
--- a/backend/server/apacheHandler.py
+++ b/backend/server/apacheHandler.py
@@ -18,7 +18,7 @@ import time
import string
# global module imports
-from mod_python import apache
+from server import apache
# common module imports
from common import rhnApache, rhnTB
diff --git a/backend/server/apacheRequest.py b/backend/server/apacheRequest.py
index 7879476..deca5dc 100644
--- a/backend/server/apacheRequest.py
+++ b/backend/server/apacheRequest.py
@@ -21,7 +21,7 @@ import base64
import string
from rhn import rpclib
from rhn.rpclib import transports
-from mod_python import apache
+from server import apache
# common modules
from common import CFG, rhnFault, rhnFlags, redirectException #to catch redirect exception
diff --git a/backend/server/apacheServer.py b/backend/server/apacheServer.py
index 9232b38..0572327 100644
--- a/backend/server/apacheServer.py
+++ b/backend/server/apacheServer.py
@@ -14,7 +14,7 @@
#
# global module imports
-from mod_python import apache
+from server import apache
# common module imports
from common import CFG, initCFG, log_setreq, initLOG, Traceback
diff --git a/backend/server/apacheUploadServer.py b/backend/server/apacheUploadServer.py
index e1939d4..372251c 100644
--- a/backend/server/apacheUploadServer.py
+++ b/backend/server/apacheUploadServer.py
@@ -16,7 +16,7 @@
#
import string
-from mod_python import apache
+from server import apache
import rhnSession
diff --git a/backend/server/basePackageUpload.py b/backend/server/basePackageUpload.py
index e177edc..d1d8483 100644
--- a/backend/server/basePackageUpload.py
+++ b/backend/server/basePackageUpload.py
@@ -17,7 +17,7 @@
import os
import tempfile
-from mod_python import apache
+from server import apache
from common import log_debug, rhnFault, UserDictCase
diff --git a/backend/server/wsgi/__init__.py b/backend/server/wsgi/__init__.py
new file mode 100644
index 0000000..d7305c3
--- /dev/null
+++ b/backend/server/wsgi/__init__.py
@@ -0,0 +1,16 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
diff --git a/backend/server/wsgi/app.py b/backend/server/wsgi/app.py
new file mode 100644
index 0000000..b66c5cf
--- /dev/null
+++ b/backend/server/wsgi/app.py
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+from server.wsgi import wsgiHandler
+
+def application(environ, start_response):
+ return wsgiHandler.handle(environ, start_response, "app","server.app")
diff --git a/backend/server/wsgi/applet.py b/backend/server/wsgi/applet.py
new file mode 100644
index 0000000..2f31885
--- /dev/null
+++ b/backend/server/wsgi/applet.py
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+from server.wsgi import wsgiHandler
+
+def application(environ, start_response):
+ return wsgiHandler.handle(environ, start_response, "applet","server.applet")
diff --git a/backend/server/wsgi/config.py b/backend/server/wsgi/config.py
new file mode 100644
index 0000000..3049ac2
--- /dev/null
+++ b/backend/server/wsgi/config.py
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+from server.wsgi import wsgiHandler
+
+def application(environ, start_response):
+ return wsgiHandler.handle(environ, start_response, "config","server.config-management")
diff --git a/backend/server/wsgi/config_tool.py b/backend/server/wsgi/config_tool.py
new file mode 100644
index 0000000..4089cc8
--- /dev/null
+++ b/backend/server/wsgi/config_tool.py
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+from server.wsgi import wsgiHandler
+
+def application(environ, start_response):
+ return wsgiHandler.handle(environ, start_response, "config_mgmt","server.config-management-tool")
diff --git a/backend/server/wsgi/package_push.py b/backend/server/wsgi/package_push.py
new file mode 100644
index 0000000..afc029b
--- /dev/null
+++ b/backend/server/wsgi/package_push.py
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+from server.wsgi import wsgiHandler
+
+def application(environ, start_response):
+ return wsgiHandler.handle(environ, start_response, "package_push","server.upload.package-push", type="upload")
diff --git a/backend/server/wsgi/package_upload.py b/backend/server/wsgi/package_upload.py
new file mode 100644
index 0000000..f8cbd51
--- /dev/null
+++ b/backend/server/wsgi/package_upload.py
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+from server.wsgi import wsgiHandler
+
+def application(environ, start_response):
+ return wsgiHandler.handle(environ, start_response, "package","server.upload.package", type="upload")
diff --git a/backend/server/wsgi/sat.py b/backend/server/wsgi/sat.py
new file mode 100644
index 0000000..82a48c4
--- /dev/null
+++ b/backend/server/wsgi/sat.py
@@ -0,0 +1,21 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+
+from server.wsgi import wsgiHandler
+
+def application(environ, start_response):
+ return wsgiHandler.handle(environ, start_response, "sat","server.iss")
diff --git a/backend/server/wsgi/sat_dump.py b/backend/server/wsgi/sat_dump.py
new file mode 100644
index 0000000..fb4b601
--- /dev/null
+++ b/backend/server/wsgi/sat_dump.py
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+from server.wsgi import wsgiHandler
+
+def application(environ, start_response):
+ return wsgiHandler.handle(environ, start_response, "non_auth_dumper", "server.satexport.internal", type='exporter')
diff --git a/backend/server/wsgi/wsgiHandler.py b/backend/server/wsgi/wsgiHandler.py
new file mode 100644
index 0000000..bc1f7c0
--- /dev/null
+++ b/backend/server/wsgi/wsgiHandler.py
@@ -0,0 +1,78 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+
+from server.wsgi import wsgiRequest
+from server import apacheServer
+from server import apacheUploadServer
+from satellite_exporter import satexport
+
+from common import log_debug
+
+def handle(environ, start_response, server, component_type, type="normal"):
+ #wsgi seems to capitalize incoming headers and add HTTP- to the front :/
+ # so we strip out the first 5 letters, and transform it into what we want.
+ replacements = {'_':'-', 'Rhn':'RHN', 'Md5Sum':'MD5Sum', 'Xml':'XML'}
+ for key in environ.keys():
+ if key[:5] == "HTTP_":
+ new_key = key[5:].title()
+ for k,v in replacements.iteritems():
+ new_key = new_key.replace(k,v)
+ environ[new_key] = environ[key]
+
+
+
+ req = wsgiRequest.WsgiRequest(environ, start_response)
+ req.set_option("SERVER", server)
+ req.set_option("RHNComponentType", component_type)
+ req.set_option("RootDir", "/usr/share/rhn")
+
+ parseServ = get_handle(type, "headerParserHandler", init=1)
+ ret = parseServ(req)
+
+ if len(req.output) > 0:
+ if not req.sent_header:
+ req.send_http_header(status=ret)
+ return req.output
+
+ appServ = get_handle(type, "handler")
+ ret = appServ(req)
+
+ if not ret:
+ ret = None
+
+ if not req.sent_header:
+ req.send_http_header(status=ret)
+
+ #exporter doesn't have a logHandler
+ if type != 'exporter':
+ logServ = get_handle(type, "logHandler")
+ logServ(req)
+ cleanServ = get_handle(type, "cleanupHandler")
+ cleanServ(req)
+
+ return req.output
+
+def get_handle(type, name, init=0):
+ if type == 'upload':
+ return apacheUploadServer.UploadHandlerWrap(name)
+ #the sat export module doesn't provide a nice server module
+ elif type == 'exporter':
+ return getattr(satexport, name)
+ else:
+ return apacheServer.HandlerWrap(name, init=init)
+
+
diff --git a/backend/server/wsgi/wsgiRequest.py b/backend/server/wsgi/wsgiRequest.py
new file mode 100644
index 0000000..81647b6
--- /dev/null
+++ b/backend/server/wsgi/wsgiRequest.py
@@ -0,0 +1,97 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+
+
+import socket
+from common import log_debug
+
+class WsgiRequest:
+
+ def __init__(self, env, start_response):
+ self.method = env['REQUEST_METHOD']
+ self.headers_in = env
+ self.path_info = env['PATH_INFO']
+ self.start_response = start_response
+ self.unparsed_uri = env['REQUEST_URI']
+ self.server = WsgiServer(env['SERVER_NAME'], env['SERVER_PORT'])
+ self.connection = WsgiConnection(env['REMOTE_ADDR'])
+ self.options = {}
+ self.main = 0
+ self.proto_num = float(env['SERVER_PROTOCOL'].split('/')[1])
+ self.headers_out = WsgiDict()
+ self.sent_header = 0
+ self.content_type = ""
+ self.the_request = env['REQUEST_METHOD'] + " " + env['SCRIPT_NAME'] + " " + env['SERVER_PROTOCOL']
+ self.output = []
+ self.err_headers_out = []
+ self.status = ""
+ self.sent_bodyct = 0
+ self.sent_header = 0
+
+ def set_option(self, key, value):
+ self.options[key] = value
+
+ def get_options(self):
+ return self.options
+
+ def get_config(self):
+ return "" #FIXME
+
+ def write(self, str):
+ self.output.append(str)
+
+ def send_http_header(self, status=None):
+ self.sent_header = 1
+
+ if len(self.status) == 0 or self.status == None:
+ self.status = "200 OK"
+ if status is not None:
+ self.status = str(status)
+
+ if len(self.content_type) > 0:
+ self.headers_out['Content-Type'] = self.content_type
+ #default to text/xml
+ if not self.headers_out.has_key('Content-Type'):
+ self.headers_out['Content-Type'] = 'text/xml'
+
+ self.start_response(self.status, self.headers_out.items())
+ return
+
+ def get_remote_host(self, rev=""):
+ host = self.headers_in['REMOTE_ADDR']
+ try:
+ host = socket.gethostbyaddr(host)[0]
+ except:
+ pass
+ return host
+
+ def read(self, buffer=-1):
+ return self.headers_in['wsgi.input'].read(buffer)
+
+
+class WsgiServer:
+ def __init__(self, hostname, port):
+ self.server_hostname = hostname
+ self.port = int(port)
+
+class WsgiConnection:
+ def __init__(self, remote_ip):
+ self.remote_ip = remote_ip
+
+class WsgiDict(dict):
+ def add(self, key, value):
+ self[key] = value;
diff --git a/backend/server/wsgi/xmlrpc.py b/backend/server/wsgi/xmlrpc.py
new file mode 100644
index 0000000..de4fadd
--- /dev/null
+++ b/backend/server/wsgi/xmlrpc.py
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+
+
+from server.wsgi import wsgiHandler
+
+def application(environ, start_response):
+ return wsgiHandler.handle(environ, start_response, "xmlrpc", "server.xmlrpc")
diff --git a/backend/server/wsgi/xp.py b/backend/server/wsgi/xp.py
new file mode 100644
index 0000000..f127690
--- /dev/null
+++ b/backend/server/wsgi/xp.py
@@ -0,0 +1,21 @@
+#
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+#
+
+
+from server.wsgi import wsgiHandler
+
+def application(environ, start_response):
+ return wsgiHandler.handle(environ, start_response, "xp","server.xp")
diff --git a/backend/upload_server/handlers/package_push/package_push.py b/backend/upload_server/handlers/package_push/package_push.py
index 0cd019e..0bf457b 100644
--- a/backend/upload_server/handlers/package_push/package_push.py
+++ b/backend/upload_server/handlers/package_push/package_push.py
@@ -22,7 +22,7 @@
import os
import base64
import string
-from mod_python import apache
+from server import apache
from rhn import rpclib
from common import CFG, log_debug, log_error, rhnFault, rhnFlags
diff --git a/backend/upload_server/handlers/package_upload/package_upload.py b/backend/upload_server/handlers/package_upload/package_upload.py
index ee49f50..0d30ba6 100644
--- a/backend/upload_server/handlers/package_upload/package_upload.py
+++ b/backend/upload_server/handlers/package_upload/package_upload.py
@@ -20,7 +20,7 @@
# $Id$
import os
-from mod_python import apache
+from server import apache
from common import CFG, log_debug, log_error, rhnFault, rhnFlags
from server import rhnPackageUpload, basePackageUpload
14 years, 3 months
Changes to 'refs/tags/rhnpush-5.4.7-1'
by Michael Mraka
Tag 'rhnpush-5.4.7-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2010-01-07 15:21 +0000
Tagging package [rhnpush] version [5.4.7-1] in directory [client/tools/rhnpush/].
Changes since spacewalk-backend-0.8.18-1:
Justin Sherrill (1):
528833 - having username printed instead of user object if user is disabled
Michael Mraka (4):
unified checksum meaning in rhnpush code
updated copyrights
fixed typo
Automatic commit of package [rhnpush] release [5.4.7-1].
---
backend/server/handlers/xmlrpc/registration.py | 2 +-
client/tools/rhnpush/connection.py | 15 ++++++++-------
client/tools/rhnpush/rhnpush.py | 25 +++++++++++++------------
client/tools/rhnpush/rhnpush.spec | 5 ++++-
client/tools/rhnpush/uploadLib.py | 9 +++++----
rel-eng/packages/rhnpush | 2 +-
6 files changed, 32 insertions(+), 26 deletions(-)
---
14 years, 3 months
client/tools rel-eng/packages
by Michael Mraka
client/tools/rhnpush/rhnpush.spec | 5 ++++-
rel-eng/packages/rhnpush | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 9bddc8c15ca258b2f17fd5de9b0f95604af751a6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jan 7 16:21:54 2010 +0100
Automatic commit of package [rhnpush] release [5.4.7-1].
diff --git a/client/tools/rhnpush/rhnpush.spec b/client/tools/rhnpush/rhnpush.spec
index 2eaf69b..eea76a3 100644
--- a/client/tools/rhnpush/rhnpush.spec
+++ b/client/tools/rhnpush/rhnpush.spec
@@ -5,7 +5,7 @@ Summary: Common programs needed to be installed on the RHN servers/proxies
Group: Applications/System
License: GPLv2
URL: http://fedorahosted.org/spacewalk
-Version: 5.4.6
+Version: 5.4.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)
@@ -50,6 +50,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man8/solaris2mpm.8*
%changelog
+* Thu Jan 07 2010 Michael Mraka <michael.mraka(a)redhat.com> 5.4.7-1
+- code cleanup
+
* Thu Dec 10 2009 Michael Mraka <michael.mraka(a)redhat.com> 5.4.6-1
- added support for SHA256 rpms
- fixed namespace for rhn_rpm
diff --git a/rel-eng/packages/rhnpush b/rel-eng/packages/rhnpush
index dd0e93c..52ff087 100644
--- a/rel-eng/packages/rhnpush
+++ b/rel-eng/packages/rhnpush
@@ -1 +1 @@
-5.4.6-1 client/tools/rhnpush/
+5.4.7-1 client/tools/rhnpush/
14 years, 3 months
3 commits - client/tools
by Michael Mraka
client/tools/rhnpush/connection.py | 15 ++++++++-------
client/tools/rhnpush/rhnpush.py | 25 +++++++++++++------------
client/tools/rhnpush/uploadLib.py | 9 +++++----
3 files changed, 26 insertions(+), 23 deletions(-)
New commits:
commit b4800a7674651192fcc841f4d8c587c08d053f20
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jan 7 16:19:53 2010 +0100
fixed typo
diff --git a/client/tools/rhnpush/rhnpush.py b/client/tools/rhnpush/rhnpush.py
index 1e854ed..a9c1f4c 100755
--- a/client/tools/rhnpush/rhnpush.py
+++ b/client/tools/rhnpush/rhnpush.py
@@ -392,7 +392,7 @@ class UploadClass(uploadLib.UploadClass):
self.warn(2, "ERROR: %s: No such file or directory available" % pkg)
continue
- checksum = getFileChecksum(checksum_type, file=payload_stream))
+ checksum = getFileChecksum(checksum_type, file=payload_stream)
f.close()
for t in range(0, tries):
commit c6ddffca512a38ad0fd7c6bc06b842c02038d967
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jan 7 16:17:53 2010 +0100
updated copyrights
diff --git a/client/tools/rhnpush/connection.py b/client/tools/rhnpush/connection.py
index d1c689b..939dce1 100644
--- a/client/tools/rhnpush/connection.py
+++ b/client/tools/rhnpush/connection.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
diff --git a/client/tools/rhnpush/rhnpush.py b/client/tools/rhnpush/rhnpush.py
index 29c357a..1e854ed 100755
--- a/client/tools/rhnpush/rhnpush.py
+++ b/client/tools/rhnpush/rhnpush.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
diff --git a/client/tools/rhnpush/uploadLib.py b/client/tools/rhnpush/uploadLib.py
index fe0e5ed..a82a5d2 100644
--- a/client/tools/rhnpush/uploadLib.py
+++ b/client/tools/rhnpush/uploadLib.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
commit 58695ee76fe14914139ed5a7d6fb092b73bfe6d2
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jan 7 16:08:44 2010 +0100
unified checksum meaning in rhnpush code
checksum sometimes means checksum string only and sometimes tuple (type, string)
to avoid confusion this commit changed all tuples into two separate variables
diff --git a/client/tools/rhnpush/connection.py b/client/tools/rhnpush/connection.py
index 4216ee3..d1c689b 100644
--- a/client/tools/rhnpush/connection.py
+++ b/client/tools/rhnpush/connection.py
@@ -169,7 +169,7 @@ class PackageUpload:
return self._response
- def upload(self, file, FileChecksum):
+ def upload(self, file, FileChecksumType, FileChecksum):
"""
Uploads a file.
Returns (http_error_code, error_message)
@@ -210,6 +210,7 @@ class PackageUpload:
self.nvra = nvra
# use the precomputed passed checksum
+ self.checksum_type = FileChecksumType
self.checksum = FileChecksum
# Set headers
@@ -222,11 +223,11 @@ class PackageUpload:
self.set_header("%s-%s" % (prefix, "Package-Release"), nvra[2])
self.set_header("%s-%s" % (prefix, "Package-Arch"), nvra[3])
self.set_header("%s-%s" % (prefix, "Packaging"), self.packaging)
- if self.checksum[0] == 'md5':
- self.set_header("%s-%s" % (prefix, "File-MD5sum"), self.checksum[1])
+ if self.checksum_type == 'md5':
+ self.set_header("%s-%s" % (prefix, "File-MD5sum"), self.checksum)
else:
- self.set_header("%s-%s" % (prefix, "File-Checksum-Type"), self.checksum[0])
- self.set_header("%s-%s" % (prefix, "File-Checksum"), self.checksum[1])
+ self.set_header("%s-%s" % (prefix, "File-Checksum-Type"), self.checksum_type)
+ self.set_header("%s-%s" % (prefix, "File-Checksum"), self.checksum)
self._response = self.send_http('POST', stream_body=f)
f.close()
@@ -246,7 +247,7 @@ class PackageUpload:
if status == 201:
# Created
return (status, "%s %s: %s-%s-%s.%s.rpm already uploaded" % (
- self.checksum[0], self.checksum[1],
+ self.checksum_type, self.checksum,
self.nvra[0], self.nvra[1], self.nvra[2], self.nvra[3]))
if status in (404, 409):
# Conflict
diff --git a/client/tools/rhnpush/rhnpush.py b/client/tools/rhnpush/rhnpush.py
index 13c24b9..29c357a 100755
--- a/client/tools/rhnpush/rhnpush.py
+++ b/client/tools/rhnpush/rhnpush.py
@@ -45,7 +45,7 @@ except ImportError:
from optik import Option, OptionParser
from rhn import rpclib
from spacewalk.common import rhn_mpm
-from spacewalk.common import checksum
+from spacewalk.common.checksum import getFileChecksum
import uploadLib
import rhnpush_v2
@@ -392,13 +392,12 @@ class UploadClass(uploadLib.UploadClass):
self.warn(2, "ERROR: %s: No such file or directory available" % pkg)
continue
- digest = (checksum_type,
- checksum.getFileChecksum(checksum_type, file=payload_stream))
+ checksum = getFileChecksum(checksum_type, file=payload_stream))
f.close()
for t in range(0, tries):
try:
- ret = self.package(pkg, digest)
+ ret = self.package(pkg, checksum_type, checksum)
if ret is None:
raise UploadError()
@@ -499,8 +498,8 @@ class UploadClass(uploadLib.UploadClass):
self.warn(2, "ERROR: %s: No such file or directory available" % pkg)
continue
- digest_hash[pkg_key] = (checksum_type,
- checksum.getFileChecksum(checksum_type, file=payload_stream))
+ checksum = getFileChecksum(checksum_type, file=payload_stream)
+ digest_hash[pkg_key] = (checksum_type, checksum)
f.close()
for tag in ('name', 'version', 'release', 'epoch', 'arch'):
@@ -517,7 +516,8 @@ class UploadClass(uploadLib.UploadClass):
pkg_info['arch'] = 'nosrc'
else:
pkg_info['arch'] = 'src'
- pkg_info['checksum'] = digest_hash[pkg_key]
+ pkg_info['checksum_type'] = checksum_type
+ pkg_info['checksum'] = checksum
pkg_hash[pkg_key] = pkg_info
if self.options.nullorg:
@@ -553,7 +553,7 @@ class UploadClass(uploadLib.UploadClass):
return (checksum_data, pkg_hash, digest_hash)
- def package(self, package, FileChecksum):
+ def package(self, package, FileChecksumType, FileChecksum):
self.warn(1, "Uploading package %s" % package)
if not os.access(package, os.R_OK):
self.die(-1, "Could not read file %s" % package)
@@ -576,7 +576,7 @@ class UploadClass(uploadLib.UploadClass):
try:
if self.ping_status == 200:
- ret = self._push_package_v2(package, FileChecksum)
+ ret = self._push_package_v2(package, FileChecksumType, FileChecksum)
else:
ret = self._push_package_xmlrpc(package, h, packaging)
except UploadError, e:
@@ -606,7 +606,7 @@ class UploadClass(uploadLib.UploadClass):
return ret
- def _push_package_v2(self, package, FileChecksum):
+ def _push_package_v2(self, package, FileChecksumType, FileChecksum):
self.warn(1, "Using POST request")
pu = rhnpush_v2.PackageUpload(self.url_v2)
@@ -617,7 +617,7 @@ class UploadClass(uploadLib.UploadClass):
pu.set_force(self.options.force)
pu.set_null_org(self.options.nullorg)
- status, msgstr = pu.upload(package, FileChecksum)
+ status, msgstr = pu.upload(package, FileChecksumType, FileChecksum)
ret = {}
for tag in ('name', 'version', 'release', 'epoch', 'arch'):
@@ -626,6 +626,7 @@ class UploadClass(uploadLib.UploadClass):
val = ''
ret[tag] = val
+ ret['checksum_type'] = FileChecksumType
ret['checksum'] = FileChecksum
if status == 400:
# Bad request - something bad happened
diff --git a/client/tools/rhnpush/uploadLib.py b/client/tools/rhnpush/uploadLib.py
index 0fa466f..fe0e5ed 100644
--- a/client/tools/rhnpush/uploadLib.py
+++ b/client/tools/rhnpush/uploadLib.py
@@ -506,8 +506,8 @@ def _processFile(filename, relativeDir=None, source=None, nosig=None):
# Rewind the file
f.seek(0, 0)
# Compute digest
- digest = (h.checksum_type(),
- checksum.getFileChecksum(h.checksum_type(), file=f))
+ checksum_type = h.checksum_type()
+ checksum = checksum.getFileChecksum(checksum_type, file=f)
f.close()
if h is None:
raise UploadError("%s is not a valid RPM file" % filename)
@@ -533,7 +533,8 @@ def _processFile(filename, relativeDir=None, source=None, nosig=None):
# Build the header hash to be sent
hash = { 'header' : Binary(h.unload()),
- 'checksum' : digest,
+ 'checksum_type' : checksum_type,
+ 'checksum' : checksum,
'packageSize' : size,
'header_start' : header_start,
'header_end' : header_end}
14 years, 3 months
backend/server
by Justin Sherrill
backend/server/handlers/xmlrpc/registration.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 1b65689d53d58f1b93a4e33df4b8c4fb95345609
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Jan 7 10:11:31 2010 -0500
528833 - having username printed instead of user object if user is disabled
diff --git a/backend/server/handlers/xmlrpc/registration.py b/backend/server/handlers/xmlrpc/registration.py
index e7b9506..4009484 100644
--- a/backend/server/handlers/xmlrpc/registration.py
+++ b/backend/server/handlers/xmlrpc/registration.py
@@ -188,7 +188,7 @@ class Registration(rhnHandler):
msg = _("""
%s Account has been deactivated on this server.
Please contact your Org administrator for more help.""")
- raise rhnFault(1, msg % user, explain=0)
+ raise rhnFault(1, msg % username, explain=0)
return user
14 years, 3 months
Changes to 'refs/tags/spacewalk-backend-0.8.18-1'
by Michael Mraka
Tag 'spacewalk-backend-0.8.18-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2010-01-07 14:35 +0000
Tagging package [spacewalk-backend] version [0.8.18-1] in directory [backend/].
Changes since spacewalk-backend-0.8.17-1:
Michael Mraka (2):
fixed syntax errors
Automatic commit of package [spacewalk-backend] release [0.8.18-1].
---
backend/satellite_tools/reposync.py | 2 +-
backend/satellite_tools/xmlSource.py | 2 +-
backend/server/rhnPackageUpload.py | 2 +-
backend/spacewalk-backend.spec | 4 ++--
backend/upload_server/handlers/package_push/package_push.py | 2 +-
backend/upload_server/handlers/package_upload/package_upload.py | 2 +-
rel-eng/packages/spacewalk-backend | 2 +-
7 files changed, 8 insertions(+), 8 deletions(-)
---
14 years, 3 months
2 commits - backend/satellite_tools backend/server backend/spacewalk-backend.spec backend/upload_server rel-eng/packages
by Michael Mraka
backend/satellite_tools/reposync.py | 2 +-
backend/satellite_tools/xmlSource.py | 2 +-
backend/server/rhnPackageUpload.py | 2 +-
backend/spacewalk-backend.spec | 4 ++--
backend/upload_server/handlers/package_push/package_push.py | 2 +-
backend/upload_server/handlers/package_upload/package_upload.py | 2 +-
rel-eng/packages/spacewalk-backend | 2 +-
7 files changed, 8 insertions(+), 8 deletions(-)
New commits:
commit c3a24a5e12f8deac4c0a339c2fc30e11bb1889e1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jan 7 15:35:33 2010 +0100
Automatic commit of package [spacewalk-backend] release [0.8.18-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 2982afb..3750640 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -8,7 +8,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 0.8.17
+Version: 0.8.18
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -588,7 +588,7 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
-* Thu Jan 07 2010 Michael Mraka <michael.mraka(a)redhat.com> 0.8.17-1
+* Thu Jan 07 2010 Michael Mraka <michael.mraka(a)redhat.com> 0.8.18-1
- made satelite-sync understand both 3.4 and 3.5 dumps
- 175155 - bump up protocol version to 3.5
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index b67de3c..d9f8300 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-0.8.17-1 backend/
+0.8.18-1 backend/
commit 918150ce58bf30bb94ef75856872095c3fccdae4
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jan 7 15:34:58 2010 +0100
fixed syntax errors
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index e166431..27d1d9b 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -151,7 +151,7 @@ class RepoSync:
header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(temp_file)
package.checksum_type = header.checksum_type()
- package.checksum = getFileChecksum(package.checksum_type, file=temp_file))
+ package.checksum = getFileChecksum(package.checksum_type, file=temp_file)
pid = rhnPackage.get_package_for_checksum(
self.channel['org_id'],
package.checksum_type, package.checksum)
diff --git a/backend/satellite_tools/xmlSource.py b/backend/satellite_tools/xmlSource.py
index e891c25..bcbda5b 100644
--- a/backend/satellite_tools/xmlSource.py
+++ b/backend/satellite_tools/xmlSource.py
@@ -478,7 +478,7 @@ class IncompletePackageItem(BaseItem):
'checksum-type' : 'checksum_type', # xml dump 3.5 (sha256)
}
- def populate(self, attributes, elements):
+ def populate(self, attributes, elements):
item = BaseItem.populate(self, attributes, elements)
if item['md5sum']:
# xml dumps < 3.5 (pre-sha256)
diff --git a/backend/server/rhnPackageUpload.py b/backend/server/rhnPackageUpload.py
index 2dcbed7..5531c94 100644
--- a/backend/server/rhnPackageUpload.py
+++ b/backend/server/rhnPackageUpload.py
@@ -127,7 +127,7 @@ def relative_path_from_nevra(nevra, org_id, package_type=None, checksum_type=Non
def relative_path_from_nevra_without_package_name(nevra, org_id, checksum_type, checksum):
log_debug(4, nevra, "no package name")
return get_package_path_without_package_name(nevra, org_id,
- prepend=CFG.PREPENDED_DIR, checksum_type, checksum)
+ CFG.PREPENDED_DIR, checksum_type, checksum)
def push_package(header, payload_stream, checksum_type, checksum, org_id=None, force=None,
header_start=None, header_end=None, channels=[], relative_path=None):
diff --git a/backend/upload_server/handlers/package_push/package_push.py b/backend/upload_server/handlers/package_push/package_push.py
index b4c02ad..0cd019e 100644
--- a/backend/upload_server/handlers/package_push/package_push.py
+++ b/backend/upload_server/handlers/package_push/package_push.py
@@ -116,7 +116,7 @@ class PackagePush(basePackageUpload.BasePackageUpload):
# Sanity check - removed, the package path can no longer be determined
# without the header
checksum_type = header.checksum_type()
- checksum = getFileChecksum(checksum_type, file=temp_stream))
+ checksum = getFileChecksum(checksum_type, file=temp_stream)
self.rel_package_path = rhnPackageUpload.relative_path_from_header(
header, org_id=self.org_id, checksum_type=checksum_type, checksum=checksum)
self.package_path = os.path.join(CFG.MOUNT_POINT,
diff --git a/backend/upload_server/handlers/package_upload/package_upload.py b/backend/upload_server/handlers/package_upload/package_upload.py
index a3cd811..ee49f50 100644
--- a/backend/upload_server/handlers/package_upload/package_upload.py
+++ b/backend/upload_server/handlers/package_upload/package_upload.py
@@ -75,7 +75,7 @@ class PackageUpload(basePackageUpload.BasePackageUpload):
header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(temp_stream)
checksum_type = header.checksum_type()
- checksum = getFileChecksum(checksum_type, file=temp_stream))
+ checksum = getFileChecksum(checksum_type, file=temp_stream)
temp_stream.close()
if not (self.file_checksum_type == checksum_type
14 years, 3 months
3 commits - backend/satellite_tools backend/server backend/spacewalk-backend.spec backend/upload_server rel-eng/packages
by Michael Mraka
backend/satellite_tools/reposync.py | 16 ++-
backend/satellite_tools/satsync.py | 44 ++++------
backend/satellite_tools/updatePackages.py | 5 -
backend/satellite_tools/xmlSource.py | 10 ++
backend/server/basePackageUpload.py | 4
backend/server/handlers/app/packages.py | 20 ++--
backend/server/handlers/xp/rhnlint.py | 4
backend/server/importlib/errataImport.py | 13 +-
backend/server/importlib/headerSource.py | 23 ++---
backend/server/importlib/importLib.py | 34 ++++---
backend/server/importlib/kickstartImport.py | 13 +-
backend/server/importlib/mpmSource.py | 11 +-
backend/server/importlib/packageImport.py | 35 ++++---
backend/server/importlib/packageUpload.py | 5 -
backend/server/importlib/test/test_solaris.py | 9 +-
backend/server/repomd/domain.py | 5 -
backend/server/repomd/mapper.py | 7 -
backend/server/repomd/view.py | 18 ++--
backend/server/rhnLib.py | 8 -
backend/server/rhnPackage.py | 6 -
backend/server/rhnPackageUpload.py | 34 +++----
backend/server/rhnServer/server_packages.py | 4
backend/spacewalk-backend.spec | 6 +
backend/upload_server/handlers/package_push/package_push.py | 16 ++-
backend/upload_server/handlers/package_upload/package_upload.py | 19 ++--
rel-eng/packages/spacewalk-backend | 2
26 files changed, 204 insertions(+), 167 deletions(-)
New commits:
commit a576e829bb4d01d8a4075db9bfe8e5128b2a7a0f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jan 7 12:57:35 2010 +0100
Automatic commit of package [spacewalk-backend] release [0.8.17-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 47e3dae..2982afb 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -8,7 +8,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 0.8.16
+Version: 0.8.17
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -588,6 +588,10 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Thu Jan 07 2010 Michael Mraka <michael.mraka(a)redhat.com> 0.8.17-1
+- made satelite-sync understand both 3.4 and 3.5 dumps
+- 175155 - bump up protocol version to 3.5
+
* Tue Jan 05 2010 Michael Mraka <michael.mraka(a)redhat.com> 0.8.16-1
- made rhn-satellite-exporter SHA256 ready
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index 06bfebf..b67de3c 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-0.8.16-1 backend/
+0.8.17-1 backend/
commit efd6d51f616d133511b4d80bb8b51ea88c0a33b3
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Jan 7 12:49:58 2010 +0100
unified checksum meaning
checksum sometimes means checksum string only and sometimes tuple (type, string)
to avoid confusion this commit changed all tuples into two separate variables
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 13bdb59..e166431 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -150,19 +150,21 @@ class RepoSync:
temp_file = open(path, 'rb')
header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(temp_file)
- checksum_type = header.checksum_type()
- package.checksum = (checksum_type, getFileChecksum(
- checksum_type, file=temp_file))
+ package.checksum_type = header.checksum_type()
+ package.checksum = getFileChecksum(package.checksum_type, file=temp_file))
pid = rhnPackage.get_package_for_checksum(
- self.channel['org_id'], package.checksum)
+ self.channel['org_id'],
+ package.checksum_type, package.checksum)
if pid is None:
rel_package_path = rhnPackageUpload.relative_path_from_header(
- header, self.channel['org_id'], package.checksum)
+ header, self.channel['org_id'],
+ package.checksum_type, package.checksum)
package_path = os.path.join(CFG.MOUNT_POINT,
rel_package_path)
package_dict, diff_level = rhnPackageUpload.push_package(header,
- payload_stream, package.checksum, force=False,
+ payload_stream, package.checksum_type, package.checksum,
+ force=False,
header_start=header_start, header_end=header_end,
relative_path=rel_package_path,
org_id=self.channel['org_id'])
@@ -179,6 +181,7 @@ class RepoSync:
package['epoch'] = pack.epoch
package['arch'] = pack.arch
package['checksum'] = pack.checksum
+ package['checksum_type'] = pack.checksum_type
package['channels'] = [{'label':self.channel_label,
'id':self.channel['id']}]
package['org_id'] = self.channel['org_id']
@@ -220,6 +223,7 @@ class ContentPackage:
def __init__(self):
# map of checksums
self.checksums = {}
+ self.checksum_type = None
self.checksum = None
#unique ID that can be used by plugin
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index 00a20b8..979b7ba 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -891,8 +891,6 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# Update the progress bar
pb.addTo(1)
pb.printIncrement()
- # make checksum tuple (type, string)
- package['checksum'] = (package['checksum_type'], package['checksum'])
self._process_package(pid, package, l_timestamp, row,
m_channel_packages, m_fs_packages, source=0)
pb.printComplete()
@@ -914,11 +912,11 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
if ul:
raise RhnSyncException, 'ERROR: incremental dump skipped'
- def _get_rel_package_path(self, nevra, org_id, source=0, checksum=None):
+ def _get_rel_package_path(self, nevra, org_id, source, checksum_type, checksum):
return get_package_path(nevra, org_id, prepend=CFG.PREPENDED_DIR,
- source=source, checksum=checksum)
+ source=source, checksum_type=checksum_type, checksum=checksum)
- def _verify_file(self, path, mtime, size, checksum):
+ def _verify_file(self, path, mtime, size, checksum_type, checksum):
"""Verifies if the file is on the filesystem and matches the mtime and
checksum
Computing the checksum is costly, that's why we rely on mtime
@@ -949,8 +947,7 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
return (0, None)
# Have to check checksum
- l_checksum = (checksum[0],
- getFileChecksum(checksum[0], filename=abs_path))
+ l_checksum = getFileChecksum(checksum_type, filename=abs_path)
if l_checksum != checksum:
# Different checksums
return (l_checksum, path)
@@ -964,6 +961,7 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
nevra = []
for t in ['name', 'epoch', 'version', 'release', 'arch']:
nevra.append(package[t])
+ checksum_type = package['checksum_type']
checksum = package['checksum']
package_size = package['package_size']
@@ -972,12 +970,12 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
else:
orgid = package['org_id']
- path = self._get_rel_package_path(nevra, orgid, source, checksum)
+ path = self._get_rel_package_path(nevra, orgid, source, checksum_type, checksum)
if not row:
# Package is missing completely from the DB
m_channel_packages.append((package_id, path))
(errcode, ret_path) = self._verify_file(path,
- l_timestamp, package_size, checksum)
+ l_timestamp, package_size, checksum_type, checksum)
if errcode == 0:
# Package on the filesystem, and matches
return
@@ -987,7 +985,8 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# Package found in the DB
db_timestamp = int(rhnLib.timestamp(row['last_modified']))
- db_checksum = (row['checksum_type'], row['checksum'])
+ db_checksum_type = row['checksum_type']
+ db_checksum = row['checksum']
db_package_size = row['package_size']
db_path = row['path']
final_path = db_path
@@ -995,7 +994,7 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# Check the filesystem
# This is one ugly piece of code
(errcode, ret_path) = self._verify_file(db_path, l_timestamp,
- package_size, checksum)
+ package_size, checksum_type, checksum)
if errcode != 0:
if errcode != 1 or path == db_path:
# Package is modified; fix it
@@ -1004,7 +1003,7 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# Package is missing, and the DB path is, for some
# reason, not the same as the computed path.
(errcode, ret_path) = self._verify_file(path,
- l_timestamp, package_size, checksum)
+ l_timestamp, package_size, checksum_type, checksum)
if errcode != 1:
# Use the computed path
final_path = path
@@ -1012,7 +1011,8 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# file is modified too; re-download
m_fs_packages.append((package_id, final_path))
- if (l_timestamp <= db_timestamp and checksum == db_checksum and
+ if (l_timestamp <= db_timestamp and
+ checksum_type == db_checksum_type and checksum == db_checksum and
package_size == db_package_size and final_path == db_path):
# Same package
return
@@ -1424,12 +1424,11 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
dest_path = os.path.join(base_path, relative_path)
timestamp = rhnLib.timestamp(f['last_modified'])
if 'md5sum' in f: # old pre-sha256 kickstart export
- checksum = ('md5', f['md5sum'])
- else:
- checksum = (f['checksum_type'], f['checksum'])
+ f['checksum_type'] = 'md5'
+ f['checksum'] = f['md5sum']
file_size = f['file_size']
(errcode, ret_path) = self._verify_file(dest_path,
- timestamp, file_size, checksum)
+ timestamp, file_size, f['checksum_type'], f['checksum'])
if errcode != 0:
# Have to download it
val = (kt_label, base_path, relative_path,
@@ -1678,11 +1677,13 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
if len(self.pkg_header_info) > 0:
for data in self.pkg_header_info:
if 'md5sum' in data: # old pre-sha256 package export
- checksum = ('md5', data['md5sum'])
+ checksum_type = 'md5'
+ checksum = data['md5sum']
else:
- checksum = (data['checksum_type'], data['checksum'])
+ checksum_type = data['checksum_type']
+ checksum = data['checksum']
server_packages.processPackageKeyAssociations(data['header'], \
- checksum)
+ checksum_type, checksum)
return self._link_channel_packages()
def _link_channel_packages(self):
diff --git a/backend/satellite_tools/updatePackages.py b/backend/satellite_tools/updatePackages.py
index faed4cf..2bafbd0 100644
--- a/backend/satellite_tools/updatePackages.py
+++ b/backend/satellite_tools/updatePackages.py
@@ -215,8 +215,9 @@ def process_package_data():
if debug: Log.writeMessage("query Executed: update rhnPackage %d to %s" \
% ( path['id'], new_path ))
# Process gpg key ids
- checksum = ('md5', md5sum) # FIXME sha256
- server_packages.processPackageKeyAssociations(hdr, checksum)
+ checksum_type = 'md5' # FIXME sha256
+ checksum = md5sum # FIXME sha256
+ server_packages.processPackageKeyAssociations(hdr, checksum_type, checksum)
if debug: Log.writeMessage("gpg key info updated from %s" % new_abs_path )
i = i + 1
# we need to break the transaction to smaller pieces
diff --git a/backend/server/basePackageUpload.py b/backend/server/basePackageUpload.py
index 3c86e3a..e177edc 100644
--- a/backend/server/basePackageUpload.py
+++ b/backend/server/basePackageUpload.py
@@ -86,8 +86,8 @@ class BasePackageUpload:
self.package_version = self.field_data["Package-Version"]
self.package_release = self.field_data["Package-Release"]
self.package_arch = self.field_data["Package-Arch"]
- self.file_checksum = (self.field_data["File-Checksum-Type"],
- self.field_data["File-Checksum"] )
+ self.file_checksum_type = self.field_data["File-Checksum-Type"]
+ self.file_checksum = self.field_data["File-Checksum"]
#4/18/05 wregglej. if 1051 is in the header's keys, then it's a nosrc package.
self.is_source = (self.package_arch == 'src' or self.package_arch == 'nosrc')
return apache.OK
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index 524daf4..2a24b63 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -289,10 +289,10 @@ class Packages(RPC_Base):
relative_path = rhnPackageUpload.relative_path_from_header(
header, org_id=org_id)
- checksum = (header.checksum_type(),
- getFileChecksum(header.checksum_type(), file=package_stream))
+ checksum_type = header.checksum_type()
+ checksum = getFileChecksum(header.checksum_type(), file=package_stream)
package_dict, diff_level = rhnPackageUpload.push_package(
- header, payload_stream, checksum, org_id=org_id, force=force,
+ header, payload_stream, checksum_type, checksum, org_id=org_id, force=force,
header_start=header_start, header_end=header_end,
relative_path=relative_path)
@@ -352,7 +352,8 @@ class Packages(RPC_Base):
_checksum_sql_filter = ""
checksum_exists = 0
if 'md5sum' in package: # for old rhnpush compatibility
- package['checksum'] = ('md5', package['md5sum'])
+ package['checksum_type'] = 'md5'
+ package['checksum'] = package['md5sum']
if package.has_key('checksum') and CFG.ENABLE_NVREA:
checksum_exists = 1
@@ -371,8 +372,8 @@ class Packages(RPC_Base):
pkg_version=package['version'], \
pkg_rel=package['release'],pkg_arch=package['arch'], \
orgid = org_id, \
- checksum_type = package['checksum'][0], \
- checksum = package['checksum'][1])
+ checksum_type = package['checksum_type'], \
+ checksum = package['checksum'])
else:
h.execute(pkg_name=package['name'], \
pkg_epoch=pkg_epoch, \
@@ -382,7 +383,8 @@ class Packages(RPC_Base):
row = h.fetchone_dict()
- package['checksum'] = (row['checksum_type'], row['checksum'])
+ package['checksum_type'] = row['checksum_type']
+ package['checksum'] = row['checksum']
package['org_id'] = org_id
package['channels'] = channelList
batch.append(IncompletePackage().populate(package))
@@ -535,8 +537,8 @@ class Packages(RPC_Base):
pkg_rel=pkg_info['release'],
pkg_arch=pkg_info['arch'],
orgid = org_id,
- checksum_type = pkg_info['checksum'][0],
- checksum = pkg_info['checksum'][1])
+ checksum_type = pkg_info['checksum_type'],
+ checksum = pkg_info['checksum'])
else:
h.execute(pkg_name=pkg_info['name'],
pkg_epoch=pkg_epoch,
diff --git a/backend/server/handlers/xp/rhnlint.py b/backend/server/handlers/xp/rhnlint.py
index 9d49ade..09cf990 100644
--- a/backend/server/handlers/xp/rhnlint.py
+++ b/backend/server/handlers/xp/rhnlint.py
@@ -308,8 +308,8 @@ def testChecksums(info, results):
'version':header['version'],
'release':header['release'],
'epoch':header['epoch'],
- 'checksum':package['checksum'][1],
- 'checksum_type':package['checksum'][0],
+ 'checksum':package['checksum'],
+ 'checksum_type':package['checksum_type'],
'org_id':info['org_id'],
'arch':header['arch'],
}
diff --git a/backend/server/importlib/errataImport.py b/backend/server/importlib/errataImport.py
index 94c2353..74cfa56 100644
--- a/backend/server/importlib/errataImport.py
+++ b/backend/server/importlib/errataImport.py
@@ -77,12 +77,11 @@ class ErrataImport(GenericPackageImport):
def _preprocessErratumFiles(self, erratum):
for f in (erratum['files'] or []):
if 'md5sum' in f: # old pre-sha256 export
- checksum = ('md5', f['md5sum'])
- else:
- checksum = (f['checksum_type'], f['checksum'])
- f['checksum'] = checksum
- if not self.checksums.has_key(checksum):
- self.checksums[checksum] = None
+ f['checksum_type'] = 'md5'
+ f['checksum'] = f['md5sum']
+ checksumTuple = (f['checksum_type'], f['checksum'])
+ if not self.checksums.has_key(checksumTuple):
+ self.checksums[checksumTuple] = None
if f['file_type'] == 'RPM':
package = f.get('pkgobj')
@@ -253,7 +252,7 @@ class ErrataImport(GenericPackageImport):
def _fix_erratum_file_packages(self, erratum):
for ef in erratum['files']:
- ef['checksum_id'] = self.checksums[ef['checksum']]
+ ef['checksum_id'] = self.checksums[(ef['checksum_type'], ef['checksum'])]
if ef['file_type'] == 'RPM':
package = ef.get('pkgobj')
if not package:
diff --git a/backend/server/importlib/headerSource.py b/backend/server/importlib/headerSource.py
index 11431c4..c182088 100644
--- a/backend/server/importlib/headerSource.py
+++ b/backend/server/importlib/headerSource.py
@@ -34,7 +34,7 @@ class rpmPackage(IncompletePackage):
'last_modified' : None,
}
- def populate(self, header, size, checksum, path=None, org_id=None,
+ def populate(self, header, size, checksum_type, checksum, path=None, org_id=None,
header_start=None, header_end=None, channels=[]):
# XXX is seems to me that this is the place that 'source_rpm' is getting
@@ -64,6 +64,7 @@ class rpmPackage(IncompletePackage):
self[f] = val
self['package_size'] = size
+ self['checksum_type'] = checksum_type
self['checksum'] = checksum
self['path'] = path
self['org_id'] = org_id
@@ -97,10 +98,10 @@ class rpmPackage(IncompletePackage):
if relpath:
# Strip trailing slashes
path = "%s/%s" % (sanitizePath(relpath), os.path.basename(f_path))
- checksum = (header.checksum_type(),
- getFileChecksum(header.checksum_type(), file=f_obj))
- self.populate(header, size, checksum, path, org_id, header_start,
- header_end, channels)
+ checksum_type = header.checksum_type()
+ checksum = getFileChecksum(header.checksum_type(), file=f_obj)
+ self.populate(header, size, checksum_type, checksum, path, org_id,
+ header_start, header_end, channels)
class rpmBinaryPackage(Package, rpmPackage):
# Various mappings
@@ -134,10 +135,10 @@ class rpmBinaryPackage(Package, rpmPackage):
'package_id' : None,
})
- def populate(self, header, size, checksum, path=None, org_id=None,
+ def populate(self, header, size, checksum_type, checksum, path=None, org_id=None,
header_start=None, header_end=None, channels=[]):
- rpmPackage.populate(self, header, size, checksum, path, org_id,
+ rpmPackage.populate(self, header, size, checksum_type, checksum, path, org_id,
header_start, header_end)
# Populate file information
@@ -249,9 +250,9 @@ class rpmSourcePackage(SourcePackage, rpmPackage):
'channels' : None,
'package_id' : None,
})
- def populate(self, header, size, checksum, path=None, org_id=None,
+ def populate(self, header, size, checksum_type, checksum, path=None, org_id=None,
header_start=None, header_end=None, channels=[]):
- rpmPackage.populate(self, header, size, checksum, path, org_id,
+ rpmPackage.populate(self, header, size, checksum_type, checksum, path, org_id,
header_start, header_end)
nvr = []
# Fill in source_rpm
@@ -361,7 +362,7 @@ def sanitizeList(l):
return l
return [l]
-def createPackage(header, size, checksum, relpath, org_id, header_start,
+def createPackage(header, size, checksum_type, checksum, relpath, org_id, header_start,
header_end, channels):
"""
Returns a populated instance of rpmBinaryPackage or rpmSourcePackage
@@ -376,7 +377,7 @@ def createPackage(header, size, checksum, relpath, org_id, header_start,
# bug #524231 - we need to call fullFilelist() for RPM v3 file list
# to expand correctly
header.hdr.fullFilelist()
- p.populate(header, size, checksum, relpath, org_id, header_start, header_end,
+ p.populate(header, size, checksum_type, checksum, relpath, org_id, header_start, header_end,
channels)
return p
diff --git a/backend/server/importlib/importLib.py b/backend/server/importlib/importLib.py
index f78a23d..9b54024 100644
--- a/backend/server/importlib/importLib.py
+++ b/backend/server/importlib/importLib.py
@@ -687,12 +687,11 @@ class GenericPackageImport(Import):
# FIXME: needs to be fixed for sha256
if not package.has_key('checksum'):
- checksum = ('md5',package['md5sum'])
- package['checksum'] = checksum
- else:
- checksum = package['checksum']
- if not self.checksums.has_key(checksum):
- self.checksums[checksum] = None
+ package['checksum_type'] = 'md5'
+ package['checksum'] = package['md5sum']
+ checksumTuple = (package['checksum_type'], package['checksum'])
+ if not self.checksums.has_key(checksumTuple):
+ self.checksums[checksumTuple] = None
def _postprocessPackageNEVRA(self, package):
arch = self.package_arches[package.arch]
@@ -713,7 +712,7 @@ class GenericPackageImport(Import):
package['name_id'], package['evr_id'], package['package_arch_id'] = nevra
package['nevra_id'] = nevra_dict[nevra]
- package['checksum_id'] = self.checksums[package['checksum']]
+ package['checksum_id'] = self.checksums[(package['checksum_type'], package['checksum'])]
# Exceptions
class ImportException(Exception):
@@ -829,13 +828,14 @@ def write_temp_package(packageData, org_id, prepend=""):
header = rhn_mpm.get_package_header(fd=fd)
# Get nevra
nevra = get_nevra(header)
- checksum = ('md5', pkgmd5sum) # FIXME sha256
+ checksum_type = 'md5' # FIXME sha256
+ checksum = pkgmd5sum # FIXME sha256
relPackagePath = get_package_path(nevra, org_id, header.is_source, prepend,
- checksum)
+ checksum_type, checksum)
# And return this information
return fd, header, packageSize, pkgmd5sum, relPackagePath
-def copy_package(fd, basedir, relpath, checksum, force=None):
+def copy_package(fd, basedir, relpath, checksum_type, checksum, force=None):
"""
Copies the information from the file descriptor to a file
Checks the file's checksum, raising FileConflictErrror if it's different
@@ -846,8 +846,7 @@ def copy_package(fd, basedir, relpath, checksum, force=None):
# Is the file there already?
if os.path.isfile(packagePath) and not force:
# Get its checksum
- localsum = (checksum[0],
- getFileChecksum(checksum[0], packagePath))
+ localsum = getFileChecksum(checksum_type, packagePath)
if checksum == localsum:
# Same file, so get outa here
return
diff --git a/backend/server/importlib/kickstartImport.py b/backend/server/importlib/kickstartImport.py
index 3aef249..564ff7e 100644
--- a/backend/server/importlib/kickstartImport.py
+++ b/backend/server/importlib/kickstartImport.py
@@ -49,12 +49,11 @@ class KickstartableTreeImport(Import):
self.ks_install_types[ks_install_label] = ks_install_name
for f in ent['files']:
if 'md5sum' in f: # old pre-sha256 export
- checksum = ('md5', f['md5sum'])
- else:
- checksum = (f['checksum_type'], f['checksum'])
- f['checksum'] = checksum
- if checksum not in self.checksums:
- self.checksums[checksum] = None
+ f['checksum_type'] = 'md5'
+ f['checksum'] = f['md5sum']
+ checksumTuple = (f['checksum_type'], f['checksum'])
+ if checksumTuple not in self.checksums:
+ self.checksums[checksumTuple] = None
def fix(self):
self.backend.lookup_kstree_types(self.kstree_types)
@@ -76,7 +75,7 @@ class KickstartableTreeImport(Import):
ent['kstree_type'] = self.kstree_types[kstree_type_label]
ent['install_type'] = self.ks_install_types[ks_install_label]
for f in ent['files']:
- f['checksum_id'] = self.checksums[f['checksum']]
+ f['checksum_id'] = self.checksums[(f['checksum_type'], f['checksum'])]
def submit(self):
diff --git a/backend/server/importlib/mpmSource.py b/backend/server/importlib/mpmSource.py
index 84472cd..8e5742e 100644
--- a/backend/server/importlib/mpmSource.py
+++ b/backend/server/importlib/mpmSource.py
@@ -80,11 +80,11 @@ class mpmBinaryPackage(headerSource.rpmBinaryPackage):
if tagMap.has_key(t):
del tagMap[t]
- def populate(self, header, size, checksum, path=None, org_id=None,
+ def populate(self, header, size, checksum_type, checksum, path=None, org_id=None,
channels=[]):
# call to base class method
- headerSource.rpmBinaryPackage.populate(self, header, size, checksum, path,
+ headerSource.rpmBinaryPackage.populate(self, header, size, checksum_type, checksum, path,
org_id, channels)
srpm = self.get('source_rpm', '')
@@ -202,15 +202,16 @@ class mpmBinaryPackage(headerSource.rpmBinaryPackage):
# top-level package object creation --------------------------------------
-def create_package(header, size, checksum, relpath, org_id, header_start=None,
+def create_package(header, size, checksum_type, checksum, relpath, org_id, header_start=None,
header_end=None, channels=[]):
if header.packaging == 'rpm':
- return headerSource.createPackage(header, size=size, checksum=checksum,
+ return headerSource.createPackage(header, size=size,
+ checksum_type=checksum_type, checksum=checksum,
relpath=relpath, org_id=org_id, header_start=header_start,
header_end=header_end, channels=channels)
if header.is_source:
raise NotImplementedError()
p = mpmBinaryPackage()
- p.populate(header, size=size, checksum=checksum, path=relpath,
+ p.populate(header, size=size, checksum_type=checksum_type, checksum=checksum, path=relpath,
org_id=org_id, channels=channels)
return p
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index a71cc95..0d1e0f0 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -252,7 +252,6 @@ class PackageImport(ChannelPackageSubscription):
self.capabilities[nv] = None
# Process files too
fileList = package['files']
- pkg_checksum_type = package['checksum'][0]
for f in fileList:
nv = (f['name'], '')
del f['name']
@@ -261,16 +260,15 @@ class PackageImport(ChannelPackageSubscription):
self.capabilities[nv] = None
if type(f['md5']) == StringType:
# xml dumps < 3.5 (pre-sha256)
- fchecksum = ('md5', f['md5'])
+ f['checksum_type'] = 'md5'
+ f['checksum'] = f['md5']
elif type(f['filedigest']) == StringType:
# import via spacewalk-repo-sync
- fchecksum = (pkg_checksum_type, f['filedigest'])
- else:
- # xml dumps > 3.5 (sha256)
- fchecksum = (f['checksum_type'], f['checksum'])
- f['checksum'] = fchecksum
- if not self.checksums.has_key(fchecksum):
- self.checksums[fchecksum] = None
+ f['checksum_type'] = package['checksum_type']
+ f['checksum'] = f['filedigest']
+ fchecksumTuple = (f['checksum_type'], f['checksum'])
+ if not self.checksums.has_key(fchecksumTuple):
+ self.checksums[fchecksumTuple] = None
# Uniquify changelog entries
changelogs = {}
@@ -369,7 +367,7 @@ class PackageImport(ChannelPackageSubscription):
else:
source_rpm = ''
package['source_rpm_id'] = source_rpm
- package['checksum_id'] = self.checksums[package['checksum']]
+ package['checksum_id'] = self.checksums[(package['checksum_type'], package['checksum'])]
# Postprocess the dependency information
for tag in ('provides', 'requires', 'conflicts', 'obsoletes', 'files'):
@@ -378,7 +376,7 @@ class PackageImport(ChannelPackageSubscription):
entry['capability_id'] = self.capabilities[nv]
fileList = package['files']
for f in fileList:
- f['checksum_id'] = self.checksums[f['checksum']]
+ f['checksum_id'] = self.checksums[(f['checksum_type'], f['checksum'])]
def __postprocessSolarisPackage(self, package):
# set solaris patch packages for a solaris patch
@@ -406,7 +404,7 @@ class PackageImport(ChannelPackageSubscription):
pkgDict['evr'] = evr
evrs[evr] = None
- checksums[pkgDict['checksum']] = None
+ checksums[(pkgDict['checksum_type'], pkgDict['checksum'])] = None
names[pkgDict['name']] = None
archs[pkgDict['arch']] = None
@@ -455,7 +453,7 @@ class PackageImport(ChannelPackageSubscription):
patchDict['evr'] = evr
evrs[evr] = None
- checksums[patchDict['checksum']] = None
+ checksums[(patchDict['checksum_type'], patchDict['checksum'])] = None
names[patchDict['name']] = None
self.backend.lookupEVRs(evrs)
@@ -494,7 +492,8 @@ class PackageImport(ChannelPackageSubscription):
package['solaris_patch_set_members'] = infoObjs
def _comparePackages(self, package1, package2):
- if package1['checksum'] == package2['checksum']:
+ if (package1['checksum_type'] == package2['checksum_type']
+ and package1['checksum'] == package2['checksum']):
return
# XXX Handle this better
raise Exception("Different packages in the same batch")
@@ -560,7 +559,8 @@ class SourcePackageImport(Import):
def _comparePackages(self, package1, package2):
- if package1['checksum'] == package2['checksum']:
+ if (package1['checksum_type'] == package2['checksum_type']
+ and package1['checksum'] == package2['checksum']):
return
# XXX Handle this better
raise Exception("Different packages in the same batch")
diff --git a/backend/server/importlib/packageUpload.py b/backend/server/importlib/packageUpload.py
index 371cf32..b6ddbf8 100644
--- a/backend/server/importlib/packageUpload.py
+++ b/backend/server/importlib/packageUpload.py
@@ -101,8 +101,9 @@ def __processPackage(package, org_id, channels, source):
# Just say the whole package
header_end = packageSize
- checksum = ('md5', md5sum) # FIXME sha256
- p = createPackage(header, packageSize, checksum, relpath, org_id,
+ checksum_type = 'md5' # FIXME sha256
+ checksum = md5sum # FIXME sha256
+ p = createPackage(header, packageSize, checksum_type, checksum, relpath, org_id,
header_start, header_end, channels)
return p
diff --git a/backend/server/importlib/test/test_solaris.py b/backend/server/importlib/test/test_solaris.py
index 5918559..a46bf8e 100644
--- a/backend/server/importlib/test/test_solaris.py
+++ b/backend/server/importlib/test/test_solaris.py
@@ -56,7 +56,8 @@ solaris_pkgs = [
'version': '4.0p1'
},
size=1024,
- checksum=('md5','somecrap'),
+ checksum_type='md5',
+ checksum='somecrap',
path='/dev/null',
org_id=1,
channels=['solaris']
@@ -105,7 +106,8 @@ solaris_patches = [
'version': '09',
},
size=1024,
- checksum=('md5','somecrap'),
+ checksum_type='md5',
+ checksum='somecrap',
path='/dev/null',
org_id=1,
channels=['solaris-patches']
@@ -196,7 +198,8 @@ solaris_patches = [
'version': '36',
},
size=1024,
- checksum=('md5','somemorecrap'),
+ checksum_type='md5',
+ checksum='somemorecrap',
path='/dev/null',
org_id=1,
channels=['solaris-patches']
diff --git a/backend/server/repomd/domain.py b/backend/server/repomd/domain.py
index 4391ee3..1fcdb1a 100644
--- a/backend/server/repomd/domain.py
+++ b/backend/server/repomd/domain.py
@@ -25,7 +25,7 @@ class Channel:
self.label = None
self.name = None
- self.checksumtype = None
+ self.checksum_type = None
self.num_packages = 0
self.packages = []
@@ -47,7 +47,8 @@ class Package:
self.epoch = 0
self.arch = None
- self.checksum = (None, None)
+ self.checksum = None
+ self.checksum_type = None
self.summary = None
self.description = None
self.vendor = None
diff --git a/backend/server/repomd/mapper.py b/backend/server/repomd/mapper.py
index 62c14d5..ced8207 100644
--- a/backend/server/repomd/mapper.py
+++ b/backend/server/repomd/mapper.py
@@ -43,7 +43,7 @@ class ChannelMapper:
select
c.label,
c.name,
- ct.label checksumtype
+ ct.label checksum_type
from
rhnChannel c,
rhnChecksumType ct
@@ -112,7 +112,7 @@ class ChannelMapper:
channel.label = details[0]
channel.name = details[1]
- channel.checksumtype = details[2]
+ channel.checksum_type = details[2]
self.channel_sql.execute(channel_id = channel_id)
package_ids = self.channel_sql.fetchall()
@@ -351,7 +351,8 @@ class SqlPackageMapper:
package.epoch = pkg[3]
package.arch = pkg[4]
- package.checksum = (pkg[20], pkg[5])
+ package.checksum_type = pkg[20]
+ package.checksum = pkg[5]
package.summary = string_to_unicode(pkg[6])
package.description = string_to_unicode(pkg[7])
package.vendor = string_to_unicode(pkg[8])
diff --git a/backend/server/repomd/view.py b/backend/server/repomd/view.py
index 268d9e2..f1f79fb 100644
--- a/backend/server/repomd/view.py
+++ b/backend/server/repomd/view.py
@@ -19,7 +19,7 @@ XML_ENCODING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
class RepoView:
def __init__(self, primary, filelists, other, updateinfo, groups, fileobj,
- checksumtype):
+ checksum_type):
self.primary = primary
self.filelists = filelists
self.other = other
@@ -27,7 +27,7 @@ class RepoView:
self.groups = groups
self.fileobj = fileobj
- self.checksumtype = checksumtype
+ self.checksum_type = checksum_type
def _get_data(self, data_type, data_obj):
output = []
@@ -35,10 +35,10 @@ class RepoView:
output.append(" <location href=\"repodata/%s.xml.gz\"/>"
% (data_type))
output.append(" <checksum type=\"%s\">%s</checksum>"
- % (self.checksumtype, data_obj['gzip_checksum']))
+ % (self.checksum_type, data_obj['gzip_checksum']))
output.append(" <timestamp>%d</timestamp>" % (data_obj['timestamp']))
output.append(" <open-checksum type=\"%s\">%s</open-checksum>"
- % (self.checksumtype, data_obj['open_checksum']))
+ % (self.checksum_type, data_obj['open_checksum']))
output.append(" </data>")
return output
@@ -48,7 +48,7 @@ class RepoView:
output.append(" <data type=\"group\">")
output.append(" <location href=\"repodata/comps.xml\"/>")
output.append(" <checksum type=\"%s\">%s</checksum>"
- % (self.checksumtype, self.groups['open_checksum']))
+ % (self.checksum_type, self.groups['open_checksum']))
output.append(" <timestamp>%d</timestamp>"
% (self.groups['timestamp']))
output.append(" </data>")
@@ -107,7 +107,7 @@ class PrimaryView(object):
output.append(" <version epoch=\"%s\" ver=\"%s\" rel=\"%s\" />"
% (package.epoch, package.version, package.release))
output.append(" <checksum type=\"%s\" pkgid=\"YES\">%s</checksum>"
- % package.checksum)
+ % (package.checksum_type, package.checksum))
output.append(" <summary>%s</summary>"
% (text_filter(package.summary)))
output.append(" <description>%s</description>"
@@ -182,7 +182,7 @@ class FilelistsView(object):
def _get_package(self, package):
output = []
output.append(" <package pkgid=\"%s\" name=\"%s\" arch=\"%s\">"
- % (package.checksum[1], package.name, package.arch))
+ % (package.checksum, package.name, package.arch))
output.append(" <version epoch=\"%s\" ver=\"%s\" rel=\"%s\" />"
% (package.epoch, package.version, package.release))
@@ -214,7 +214,7 @@ class OtherView(object):
def _get_package(self, package):
output = []
output.append(" <package pkgid=\"%s\" name=\"%s\" arch=\"%s\">"
- % (package.checksum[1], package.name, package.arch))
+ % (package.checksum, package.name, package.arch))
output.append(" <version epoch=\"%s\" ver=\"%s\" rel=\"%s\" />"
% (package.epoch, package.version, package.release))
@@ -285,7 +285,7 @@ class UpdateinfoView(object):
output.append(" <filename>%s</filename>"
% text_filter(package.filename))
output.append(" <sum type=\"%s\">%s</sum>"
- % package.checksum)
+ % (package.checksum_type, package.checksum))
output.append(" </package>")
output.append(" </collection>")
diff --git a/backend/server/rhnLib.py b/backend/server/rhnLib.py
index 83dd0b7..23c5538 100644
--- a/backend/server/rhnLib.py
+++ b/backend/server/rhnLib.py
@@ -165,7 +165,7 @@ def transpose_to_hash(arr, column_names):
return rh
def get_package_path(nevra, org_id, source=0, prepend="", omit_epoch=None,
- package_type='rpm', checksum=(None,None)):
+ package_type='rpm', checksum_type=None, checksum=None):
""" Computes a package path, optionally prepending a prefix
The path will look like
<prefix>/<org_id>/checksum[:3]/n/e:v-r/a/checksum/n-v-r.a.rpm if not omit_epoch
@@ -189,7 +189,7 @@ def get_package_path(nevra, org_id, source=0, prepend="", omit_epoch=None,
# normpath sanitizes the path (removing duplicated / and such)
template = os.path.normpath(prepend +
"/%s/%s/%s/%s-%s/%s/%s/%s-%s-%s.%s.%s")
- return template % (org, checksum[1][:3], name, version, release, dirarch, checksum[1],
+ return template % (org, checksum[:3], name, version, release, dirarch, checksum,
name, nevra[2], release, pkgarch, package_type)
@@ -200,10 +200,10 @@ def get_package_path(nevra, org_id, source=0, prepend="", omit_epoch=None,
# This enables us to append an arbitrary file name that is not restricted to the
# form: name-version-release.arch.type
def get_package_path_without_package_name(nevra, org_id, prepend="",
- checksum=(None,None)):
+ checksum_type=None, checksum=None):
"""return a package path without the package name appended"""
return os.path.dirname(get_package_path(nevra, org_id, prepend=prepend,
- checksum=checksum))
+ checksum_type=checksum_type, checksum=checksum))
class CallableObj:
diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index d550d42..4340b46 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -433,9 +433,9 @@ def get_channels_for_package(pkg):
return map(lambda c: c['label'], ret)
def get_package_for_md5sum(org_id, md5sum):
- return get_package_for_checksum(org_id, ('md5', md5sum))
+ return get_package_for_checksum(org_id, 'md5', md5sum)
-def get_package_for_checksum(org_id, checksum):
+def get_package_for_checksum(org_id, checksum_type, checksum):
statement = """
select
p.id
@@ -448,7 +448,7 @@ def get_package_for_checksum(org_id, checksum):
and c.checksum_type = :checksumtype
"""
h = rhnSQL.prepare(statement)
- h.execute(org_id=org_id, checksum=checksum[1], checksumtype=checksum[0])
+ h.execute(org_id=org_id, checksum=checksum, checksumtype=checksum_type)
ret = h.fetchone_dict()
if not ret:
return None
diff --git a/backend/server/rhnPackageUpload.py b/backend/server/rhnPackageUpload.py
index be46d98..2dcbed7 100644
--- a/backend/server/rhnPackageUpload.py
+++ b/backend/server/rhnPackageUpload.py
@@ -89,7 +89,7 @@ def _authenticate(authobj, channels, null_org, force):
return org_id, force
-def relative_path_from_header(header, org_id, checksum=(None,None)):
+def relative_path_from_header(header, org_id, checksum_type=None, checksum=None):
nevra = importLib.get_nevra(header)
if header.is_source:
#4/18/05 wregglej. if 1051 is in the header's keys, then it's a nosrc package.
@@ -106,13 +106,13 @@ def relative_path_from_header(header, org_id, checksum=(None,None)):
header["package_name"]:
rel_path = relative_path_from_nevra_without_package_name(nevra, org_id,
- checksum)
+ checksum_type, checksum)
return os.path.join(rel_path, header["package_name"])
return relative_path_from_nevra(nevra,
- org_id, header.packaging, checksum)
+ org_id, header.packaging, checksum_type, checksum)
-def relative_path_from_nevra(nevra, org_id, package_type=None, checksum=None):
+def relative_path_from_nevra(nevra, org_id, package_type=None, checksum_type=None, checksum=None):
#4/18/05 wregglej. if 1051 is in the header's keys, then it's a nosrc package.
if nevra[4] == 'src' or nevra[4] == 'nosrc':
is_source = 1
@@ -121,15 +121,15 @@ def relative_path_from_nevra(nevra, org_id, package_type=None, checksum=None):
log_debug(4, nevra, is_source)
return get_package_path(nevra, org_id=org_id, source=is_source,
prepend=CFG.PREPENDED_DIR, omit_epoch=1, package_type=package_type,
- checksum=checksum)
+ checksum_type=checksum_type, checksum=checksum)
# bug #161989 - get the relative path from the nevra, but omit the package name
-def relative_path_from_nevra_without_package_name(nevra, org_id, checksum):
+def relative_path_from_nevra_without_package_name(nevra, org_id, checksum_type, checksum):
log_debug(4, nevra, "no package name")
return get_package_path_without_package_name(nevra, org_id,
- prepend=CFG.PREPENDED_DIR, checksum=checksum)
+ prepend=CFG.PREPENDED_DIR, checksum_type, checksum)
-def push_package(header, payload_stream, checksum, org_id=None, force=None,
+def push_package(header, payload_stream, checksum_type, checksum, org_id=None, force=None,
header_start=None, header_end=None, channels=[], relative_path=None):
"""Uploads an RPM package
"""
@@ -143,13 +143,14 @@ def push_package(header, payload_stream, checksum, org_id=None, force=None,
# First write the package to the filesystem to final location
try:
importLib.copy_package(payload_stream.fileno(), basedir=CFG.MOUNT_POINT,
- relpath=relative_path, checksum=checksum, force=1)
+ relpath=relative_path, checksum_type=checksum_type, checksum=checksum, force=1)
except OSError, e:
raise rhnFault(50, "Package upload failed: %s" % e)
except importLib.FileConflictError:
raise rhnFault(50, "File already exists")
- pkg = mpmSource.create_package(header, size=payload_size, checksum=checksum,
+ pkg = mpmSource.create_package(header, size=payload_size,
+ checksum_type=checksum_type, checksum=checksum,
relpath=relative_path, org_id=org_id, header_start=header_start,
header_end=header_end, channels=channels)
@@ -234,7 +235,7 @@ def push_package(header, payload_stream, checksum, org_id=None, force=None,
else:
h_package_table = 'rhnPackage'
h_path = rhnSQL.prepare(h_path_sql % h_package_table)
- h_path.execute(ctype=checksum[0], csum=checksum[1], org_id = org_id)
+ h_path.execute(ctype=checksum_type, csum=checksum, org_id = org_id)
rs_path = h_path.fetchall_dict()
path_dict = {}
@@ -252,13 +253,13 @@ def push_package(header, payload_stream, checksum, org_id=None, force=None,
where c.checksum = :csum
and c.checksum_type = :ctype)
""")
- h_upd.execute(path=relative_path, ctype=checksum[0], csum=checksum[1])
+ h_upd.execute(path=relative_path, ctype=checksum_type, csum=checksum)
# commit the transactions
rhnSQL.commit()
if not header.is_source:
# Process Package Key information
- server_packages.processPackageKeyAssociations(header, checksum)
+ server_packages.processPackageKeyAssociations(header, checksum_type, checksum)
if not header.is_source:
errataCache.schedule_errata_cache_update(importer.affected_channels)
@@ -310,15 +311,14 @@ class AlreadyUploadedError(Exception):
class PackageConflictError(Exception):
pass
-def check_package_exists(package_path, package_checksum, force=0):
+def check_package_exists(package_path, package_checksum_type, package_checksum, force=0):
if not os.path.exists(package_path):
return
# File exists, same checksum?
- checksum = (package_checksum[0],
- getFileChecksum(package_checksum[0], package_path))
+ checksum = getFileChecksum(package_checksum_type, package_path)
if package_checksum == checksum and not force:
raise AlreadyUploadedError(package_path)
if force:
return
- raise PackageConflictError(package_path, checksum)
+ raise PackageConflictError(package_path, package_checksum_type, checksum)
diff --git a/backend/server/rhnServer/server_packages.py b/backend/server/rhnServer/server_packages.py
index 7b02095..bad30bb 100644
--- a/backend/server/rhnServer/server_packages.py
+++ b/backend/server/rhnServer/server_packages.py
@@ -374,7 +374,7 @@ def update_errata_cache(server_id):
# Return the number of changes
return changed
-def processPackageKeyAssociations(header, checksum):
+def processPackageKeyAssociations(header, checksum_type, checksum):
provider_sql = rhnSQL.prepare("""
insert into rhnPackageKeyAssociation
(package_id, key_id) values
@@ -415,7 +415,7 @@ def processPackageKeyAssociations(header, checksum):
and key_id = :key_id
""")
- lookup_pkgid_sql.execute(ctype=checksum[0], csum=checksum[1])
+ lookup_pkgid_sql.execute(ctype=checksum_type, csum=checksum)
pkg_id = lookup_pkgid_sql.fetchall_dict()
if not pkg_id:
diff --git a/backend/upload_server/handlers/package_push/package_push.py b/backend/upload_server/handlers/package_push/package_push.py
index 4651356..b4c02ad 100644
--- a/backend/upload_server/handlers/package_push/package_push.py
+++ b/backend/upload_server/handlers/package_push/package_push.py
@@ -115,21 +115,23 @@ class PackagePush(basePackageUpload.BasePackageUpload):
# Sanity check - removed, the package path can no longer be determined
# without the header
- checksum = (header.checksum_type(),
- getFileChecksum(header.checksum_type(), file=temp_stream))
+ checksum_type = header.checksum_type()
+ checksum = getFileChecksum(checksum_type, file=temp_stream))
self.rel_package_path = rhnPackageUpload.relative_path_from_header(
- header, org_id=self.org_id, checksum=checksum)
+ header, org_id=self.org_id, checksum_type=checksum_type, checksum=checksum)
self.package_path = os.path.join(CFG.MOUNT_POINT,
self.rel_package_path)
# Verify the checksum of the bytes we downloaded against the checksum
# presented by rhnpush in the HTTP headers
- if checksum != self.file_checksum:
- log_debug(1, "Mismatching checksums: expected", self.file_checksum,
- "; got:", checksum)
+ if not (checksum_type == self.file_checksum_type
+ and checksum == self.file_checksum):
+ log_debug(1, "Mismatching checksums: expected",
+ self.file_checksum_type, self.file_checksum,
+ "; got:", checksum_type, checksum)
raise rhnFault(104, "Mismatching information")
package_dict, diff_level = rhnPackageUpload.push_package(header,
- payload_stream, checksum, force=self.force,
+ payload_stream, checksum_type, checksum, force=self.force,
header_start=header_start, header_end=header_end,
relative_path=self.rel_package_path, org_id=self.org_id)
diff --git a/backend/upload_server/handlers/package_upload/package_upload.py b/backend/upload_server/handlers/package_upload/package_upload.py
index 1baf18c..a3cd811 100644
--- a/backend/upload_server/handlers/package_upload/package_upload.py
+++ b/backend/upload_server/handlers/package_upload/package_upload.py
@@ -46,7 +46,7 @@ class PackageUpload(basePackageUpload.BasePackageUpload):
try:
rhnPackageUpload.check_package_exists(self.package_path,
- self.file_checksum, force=0)
+ self.file_checksum_type, self.file_checksum, force=0)
except rhnPackageUpload.AlreadyUploadedError:
log_debug(2, "Already exists", self.rel_package_path)
return apache.HTTP_CREATED
@@ -56,8 +56,8 @@ class PackageUpload(basePackageUpload.BasePackageUpload):
raise rhnFault(104,
"Package %s (%s: %s) already exists, with checksum (%s: %s) " %
(os.path.basename(self.package_path),
- self.file_checksum[0], self.file_checksum[1],
- e.args[1][0], e.args[1][1]))
+ self.file_checksum_type, self.file_checksum,
+ e.args[1], e.args[2]))
return apache.OK
@@ -74,14 +74,15 @@ class PackageUpload(basePackageUpload.BasePackageUpload):
temp_stream = rhnPackageUpload.write_temp_file(req, buffer_size)
header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(temp_stream)
- checksum = (header.checksum_type(),
- getFileChecksum(header.checksum_type(), file=temp_stream))
+ checksum_type = header.checksum_type()
+ checksum = getFileChecksum(checksum_type, file=temp_stream))
temp_stream.close()
- if self.file_checksum != checksum:
+ if not (self.file_checksum_type == checksum_type
+ and self.file_checksum == checksum):
raise rhnFault(501, "Uploaded: (%s: %s); filesystem: (%s: %s)" %
- (self.file_checksum[0], self.file_checksum[1],
- checksum[0], checksum[1]))
+ (self.file_checksum_type, self.file_checksum,
+ checksum_type, checksum))
if not rhnPackageUpload.source_match(self.is_source, header.is_source):
# Unexpected rpm package type
@@ -113,7 +114,7 @@ class PackageUpload(basePackageUpload.BasePackageUpload):
rhnFlags.set("apache-return-code", apache.HTTP_CONFLICT)
raise rhnFault(103, "Package %s (%s: %s) is not signed" %
(os.path.basename(self.package_path),
- self.file_checksum[0], self.file_checksum[1]))
+ self.file_checksum_type, self.file_checksum))
payload_stream.seek(0, 0)
dirname = os.path.dirname(self.package_path)
commit e2282b2fe0820ece3574612ef32f7e47a2fe3bcb
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Jan 6 16:46:30 2010 +0100
making satelite-sync understand both 3.4 and 3.5 dumps
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index adc9c7f..00a20b8 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -877,9 +877,6 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
package = package_collection.get_package(pid, p_timestamp)
assert package is not None
nevra = {}
- if 'md5sum' in package: # old pre-sha256 export
- package['checksum_type'] = 'md5'
- package['checksum'] = package['md5sum']
for t in nvrea_keys:
nevra[t] = package[t] or ""
diff --git a/backend/satellite_tools/xmlSource.py b/backend/satellite_tools/xmlSource.py
index 5c4a3b3..e891c25 100644
--- a/backend/satellite_tools/xmlSource.py
+++ b/backend/satellite_tools/xmlSource.py
@@ -475,7 +475,17 @@ class IncompletePackageItem(BaseItem):
'last-modified' : 'last_modified',
'package-arch' : 'arch',
'org-id' : 'org_id',
+ 'checksum-type' : 'checksum_type', # xml dump 3.5 (sha256)
}
+
+ def populate(self, attributes, elements):
+ item = BaseItem.populate(self, attributes, elements)
+ if item['md5sum']:
+ # xml dumps < 3.5 (pre-sha256)
+ item['checksum_type'] = 'md5'
+ item['checksum'] = item['md5sum']
+ del(item['md5sum'])
+ return item
addItem(IncompletePackageItem)
class PackageItem(IncompletePackageItem):
diff --git a/backend/server/importlib/importLib.py b/backend/server/importlib/importLib.py
index 8eb67e5..f78a23d 100644
--- a/backend/server/importlib/importLib.py
+++ b/backend/server/importlib/importLib.py
@@ -233,11 +233,15 @@ class File(Item):
'rdev' : IntType,
'file_size' : IntType,
'mtime' : DateType,
- 'filedigest' : StringType,
'linkto' : StringType,
'flags' : IntType,
'verifyflags' : IntType,
'lang' : StringType,
+ # those attributes are mutualy exclusive
+ 'md5' : StringType, # xml dumps < 3.5
+ 'filedigest' : StringType, # spacewalk-repo-sync
+ 'checksum' : StringType, # xml dumps >= 3.5
+ 'checksum_type' : StringType, # xml dumps >= 3.5
}
def __init__(self):
Item.__init__(self, self.attributeTypes)
@@ -272,9 +276,12 @@ class IncompletePackage(BaseInformation):
'release' : StringType,
'arch' : StringType,
'org_id' : IntType,
- 'md5sum' : StringType,
'package_size' : IntType,
'last_modified' : DateType,
+ # those attributes are mutualy exclusive
+ 'md5sum' : StringType, # xml dumps < 3.5
+ 'checksum' : StringType, # xml dumps >= 3.5
+ 'checksum_type' : StringType, # xml dumps >= 3.5
# These attributes are lists of objects
'channels' : [StringType],
}
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index e6119ea..a71cc95 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -259,11 +259,14 @@ class PackageImport(ChannelPackageSubscription):
f['capability'] = nv
if not self.capabilities.has_key(nv):
self.capabilities[nv] = None
- if 'md5' in f: # old pre-sha256 export
+ if type(f['md5']) == StringType:
+ # xml dumps < 3.5 (pre-sha256)
fchecksum = ('md5', f['md5'])
- elif 'filedigest' in f: # import via spacewalk-repo-sync
+ elif type(f['filedigest']) == StringType:
+ # import via spacewalk-repo-sync
fchecksum = (pkg_checksum_type, f['filedigest'])
else:
+ # xml dumps > 3.5 (sha256)
fchecksum = (f['checksum_type'], f['checksum'])
f['checksum'] = fchecksum
if not self.checksums.has_key(fchecksum):
14 years, 3 months
Changes to 'refs/tags/spacewalk-backend-0.8.17-1'
by Michael Mraka
Tag 'spacewalk-backend-0.8.17-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2010-01-07 11:57 +0000
Tagging package [spacewalk-backend] version [0.8.17-1] in directory [backend/].
Changes since perl-NOCpulse-Probe-1.183.12-1:
Michael Mraka (7):
made comment more clear
fixed version acording to supported protocol
Update copyright in backend subtree for files changed in 2010.
Update copyright in backend subtree for files changed in 2009.
making satelite-sync understand both 3.4 and 3.5 dumps
unified checksum meaning
Automatic commit of package [spacewalk-backend] release [0.8.17-1].
---
backend/common/rhnApache.py | 2
backend/common/rhnCache.py | 2
backend/common/rhnConfig.py | 2
backend/common/rhnException.py | 2
backend/common/rhnLib.py | 2
backend/common/rhnRepository.py | 2
backend/common/rhnTB.py | 2
backend/satellite_exporter/constants.py | 2
backend/satellite_exporter/handlers/non_auth_dumper.py | 2
backend/satellite_tools/accounts/Makefile | 2
backend/satellite_tools/connection.py | 2
backend/satellite_tools/diskImportLib.py | 2
backend/satellite_tools/disk_dumper/dumper.py | 2
backend/satellite_tools/disk_dumper/iss.py | 2
backend/satellite_tools/disk_dumper/iss_actions.py | 2
backend/satellite_tools/disk_dumper/rhn-satellite-exporter | 2
backend/satellite_tools/exporter/exportLib.py | 2
backend/satellite_tools/exporter/exporter.py | 2
backend/satellite_tools/exporter/xmlWriter.py | 2
backend/satellite_tools/repo_plugins/__init__.py | 2
backend/satellite_tools/repo_plugins/yum_src.py | 2
backend/satellite_tools/reposync.py | 18 ++-
backend/satellite_tools/rhn_satellite_activate.py | 2
backend/satellite_tools/satCerts.py | 2
backend/satellite_tools/satComputePkgHeaders.py | 2
backend/satellite_tools/satellite-sync.sgml | 2
backend/satellite_tools/satrm.py | 2
backend/satellite_tools/satsync.py | 46 ++++------
backend/satellite_tools/spacewalk-debug | 2
backend/satellite_tools/spacewalk-repo-sync | 2
backend/satellite_tools/syncLib.py | 2
backend/satellite_tools/sync_handlers.py | 2
backend/satellite_tools/test/test-download.py | 2
backend/satellite_tools/test/test-errata.py | 2
backend/satellite_tools/updatePackages.py | 7 -
backend/satellite_tools/xmlDiskSource.py | 2
backend/satellite_tools/xmlSource.py | 14 ++-
backend/server/action/activation.py | 2
backend/server/action/configfiles.py | 2
backend/server/action/packages.py | 2
backend/server/action/solarispkgs.py | 2
backend/server/action/utils.py | 2
backend/server/action_extra_data/packages.py | 2
backend/server/basePackageUpload.py | 6 -
backend/server/configFilesHandler.py | 2
backend/server/handlers/app/comps.py | 2
backend/server/handlers/app/packages.py | 22 ++--
backend/server/handlers/app/rhn_mpm.py | 2
backend/server/handlers/applet/applet.py | 2
backend/server/handlers/config/rhn_config_management.py | 2
backend/server/handlers/config_mgmt/rhn_config_management.py | 2
backend/server/handlers/xmlrpc/__init__.py | 2
backend/server/handlers/xmlrpc/country.py | 2
backend/server/handlers/xmlrpc/errata.py | 2
backend/server/handlers/xmlrpc/getMethod.py | 2
backend/server/handlers/xmlrpc/queue.py | 2
backend/server/handlers/xmlrpc/registration.py | 2
backend/server/handlers/xmlrpc/up2date.py | 2
backend/server/handlers/xp/rhnlint.py | 6 -
backend/server/importlib/backend.py | 2
backend/server/importlib/backendLib.py | 2
backend/server/importlib/backendOracle.py | 2
backend/server/importlib/channelImport.py | 2
backend/server/importlib/errataImport.py | 15 +--
backend/server/importlib/headerSource.py | 25 ++---
backend/server/importlib/importLib.py | 36 ++++---
backend/server/importlib/kickstartImport.py | 15 +--
backend/server/importlib/mpmSource.py | 13 +-
backend/server/importlib/packageImport.py | 37 ++++----
backend/server/importlib/packageUpload.py | 7 -
backend/server/importlib/test/test_solaris.py | 11 +-
backend/server/repomd/domain.py | 7 -
backend/server/repomd/mapper.py | 9 +
backend/server/repomd/repository.py | 2
backend/server/repomd/view.py | 20 ++--
backend/server/rhnAction.py | 2
backend/server/rhnCapability.py | 2
backend/server/rhnChannel.py | 2
backend/server/rhnDependency.py | 2
backend/server/rhnHandler.py | 2
backend/server/rhnKickstart.py | 2
backend/server/rhnLib.py | 10 +-
backend/server/rhnPackage.py | 8 -
backend/server/rhnPackageUpload.py | 36 +++----
backend/server/rhnSQL/driver_cx_Oracle.py | 2
backend/server/rhnSQL/driver_postgresql.py | 2
backend/server/rhnSQL/sql_base.py | 2
backend/server/rhnSQL/sql_sequence.py | 2
backend/server/rhnServer/server_class.py | 2
backend/server/rhnServer/server_history.py | 2
backend/server/rhnServer/server_kickstart.py | 2
backend/server/rhnServer/server_lib.py | 2
backend/server/rhnServer/server_packages.py | 6 -
backend/server/rhnServer/server_solarispatches.py | 2
backend/server/rhnServer/server_token.py | 2
backend/server/rhnServer/server_wrapper.py | 2
backend/server/rhnSession.py | 2
backend/server/rhnUser.py | 2
backend/server/rhnVirtualization.py | 7 -
backend/spacewalk-backend.spec | 6 +
backend/spacewalk/common/rhn_mpm.py | 2
backend/spacewalk/common/rhn_rpm.py | 2
backend/test/non-unit/server/rhnSQL/dbtests.py | 2
backend/test/runtests-oracle.py | 2
backend/test/runtests-postgresql.py | 2
backend/test/runtests.py | 2
backend/test/unit/spacewalk/test/common/rhnLib-tests.py | 2
backend/test/unit/spacewalk/test/server/rhnsql-tests.py | 2
backend/upload_server/handlers/package_push/package_push.py | 18 ++-
backend/upload_server/handlers/package_upload/package_upload.py | 21 ++--
rel-eng/packages/spacewalk-backend | 2
111 files changed, 315 insertions(+), 281 deletions(-)
---
14 years, 3 months