java/code
by Šimon Lukašík
java/code/src/com/redhat/rhn/taskomatic/task/repomd/DebPackageWriter.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
New commits:
commit c70a0d8e3220f8566f978bb995eb084fa1ae4b91
Author: Simon Lukasik <slukasik(a)redhat.com>
Date: Fri Dec 31 10:28:13 2010 +0100
Correct the Filename tag in Packages.gz
Apt-get uses this string as a source uri.
diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/DebPackageWriter.java b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/DebPackageWriter.java
index 4138aab..e177eec 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/DebPackageWriter.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/DebPackageWriter.java
@@ -37,6 +37,7 @@ public class DebPackageWriter {
private static Logger log = Logger.getLogger(DebPackageWriter.class);
private String filenamePackages = "";
+ private String channelLabel = "";
private PackageCapabilityIterator providesIterator;
private PackageCapabilityIterator requiresIterator;
private PackageCapabilityIterator conflictsIterator;
@@ -50,6 +51,7 @@ public class DebPackageWriter {
public DebPackageWriter(Channel channel, String prefix) {
log.debug("DebPackageWriter created");
try {
+ channelLabel = channel.getLabel();
filenamePackages = prefix + "Packages";
File f = new File(filenamePackages);
if (f.exists()) {
@@ -119,9 +121,9 @@ public class DebPackageWriter {
addPackageDepData(out, obsoletesIterator, pkgDto.getId()
.longValue(), "Replaces");
- // TODO FIX path to package, Apache needs access to it
- out.write("Filename: ");
- out.write("/var/satellite/" + pkgDto.getPath());
+ out.write("Filename: XMLRPC/GET-REQ/" + channelLabel + "/getPackage/" +
+ pkgDto.getName() + "-" + pkgDto.getVersion() + "-" +
+ pkgDto.getRelease() + "." + pkgDto.getArchLabel() + ".deb");
out.newLine();
// size of package, is checked by apt
12 years, 9 months
Changes to 'refs/tags/spacewalk-backend-1.3.36-1'
by Michael Mraka
Tag 'spacewalk-backend-1.3.36-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2010-12-30 22:20 +0000
Tagging package [spacewalk-backend] version [1.3.36-1] in directory [backend/].
Changes since spacewalk-selinux-1.3.1-1:
Michael Mraka (41):
fixed W0402: 17: Uses of a deprecated module 'string'
fixed W0622: 71:UserDictCase.update: Redefining built-in 'dict'
fixed C0322: 44: Operator not preceded by a space HTTP_PROXY_AUTHENTICATION_REQUIRED= 407
fixed W0402: 21: Uses of a deprecated module 'string'
fixed W0402: 19: Uses of a deprecated module 'string'
fixed W0201: 31:RHN_Translations._parse: Attribute 'lang' defined outside __init__
fixed C0321: 81:i18n.set: More than one statement on a single line
fixed W0201: 57:i18n._set_catalog: Attribute 'cat' defined outside __init__
fixed W0622: 89:N_: Redefining built-in 'str'
fixed W0402: 17: Uses of a deprecated module 'string'
fixed W0231:343:rhnException.__init__: __init__ method from base class 'Exception' is not called fixed W0141:344:rhnException.__init__: Used builtin function 'apply'
fixed W0201:219:rhnApache.setlang: Attribute 'domain' defined outside __init__
fixed W0511:313: XXX poking at gzip.zlib may not be such a good idea
fixed W0404: 29: Reimport 'fcntl' (imported line 22)
fixed W0232:239:Cache: Class has no __init__ method
fixed C0324:251:Cache.set: Comma not followed by a space def set(self, name, value, modified = None, user='root', group='root',\ ^^ mode=0755): fixed C0324:360:ObjectCache.set: Comma not followed by a space def set(self, name, value, modified = None, user='root', group='root',\ ^^ mode=0755):
fixed W0612:318:CompressedCache.get: Unused variable 'e'
fixed W0622:762: Redefining built-in 'list'
fixed W0402: 20: Uses of a deprecated module 'string'
fixed W0622: 57:RHNOptions.__init__: Redefining built-in 'file' W0622: 71:RHNOptions._init: Redefining built-in 'file' W0622:558:parse_file: Redefining built-in 'file' W0622:597:read_file: Redefining built-in 'file'
fixed W0621: 82:RHNOptions.setComponent: Redefining name 'comp' from outer scope (line 761) W0621:148:RHNOptions._parseDefaults: Redefining name 'comp' from outer scope (line 761) W0621:243:RHNOptions.writeConfig: Redefining name 'comp' from outer scope (line 761) W0621:270:RHNOptions.diffConfig: Redefining name 'comp' from outer scope (line 761) W0621:389:RHNOptions.__merge: Redefining name 'comp' from outer scope (line 761) W0621:585:parse_file: Redefining name 'comp' from outer scope (line 761) W0621:633:getAllComponents_tree: Redefining name 'comp' from outer scope (line 761) W0621:667:getAllComponents_tuples: Redefining name 'comp' from outer scope (line 761)
fixed W0621:180:RHNOptions.has_key: Redefining name 'key' from outer scope (line 762) W0621:192:RHNOptions.set: Redefining name 'key' from outer scope (line 762) W0621:227:RHNOptions.writeConfig: Redefining name 'key' from outer scope (line 762) W0621:321:RHNOptions.__getattr__: Redefining name 'key' from outer scope (line 762) W0621:358:RHNOptions.get: Redefining name 'key' from outer scope (line 762) W0621:400:RHNOptions.__merge: Redefining name 'key' from outer scope (line 762) W0621:469:parse_line.sanitize_value: Redefining name 'key' from outer scope (line 762) W0621:531:unparse_line: Redefining name 'key' from outer scope (line 762) W0621:586:parse_file: Redefining name 'key' from outer scope (line 762) W0621:641:getAllComponents_tree: Redefining name 'key' from outer scope (line 762)
fixed W0612:401:RHNOptions.__merge: Unused variable 'lineno' W0511:402: XXX: we don't really want to force every item in the
fixed W0201: 78:RHNOptions._init: Attribute 'filename' defined outside __init__ W0201: 80:RHNOptions._init: Attribute 'root' defined outside __init__
fixed C0322:646:getAllComponents_tree: Operator not preceded by a space d[key]={} ^
fixed W0621:695:runTest: Redefining name 'cfg' from outer scope (line 778)
fixed W0212:705:runTest: Access to a protected member _getDefaults of a client class W0212:716:runTest: Access to a protected member _showall of a client class
fixed W0212:685:initCFG: Access to a protected member _init of a client class
fixed W0402: 18: Uses of a deprecated module 'string'
fixed W0612: 65:rfc822time: Unused variable 'tm_isdst' W0612: 65:rfc822time: Unused variable 'tm_yday'
fixed W0402: 19: Uses of a deprecated module 'string'
fixed W0402: 20: Uses of a deprecated module 'string'
fixed E1101:616:CachedDumper._get_key: Instance of 'CachedDumper' has no 'item_id_key' member
removed dead module
removed usage of dead rhnDatabaseCache from other modules
removed dead rhnDatabaseCache from build scripts
removed tests of dead rhnDatabaseCache
use_database_cache is meaningless after rhnDatabaseCache removal
fixed E:442:XML_Dumper._validate_channels: Too many arguments for format string
fixed E:183:XML_Dumper.dump_channel_families: Instance of 'XML_Dumper' has no 'channel_ids' member
Automatic commit of package [spacewalk-backend] release [1.3.36-1].
Simon Lukasik (1):
Allow clients to retrieve debian packages
---
backend/common/UserDictCase.py | 16
backend/common/apache.py | 2
backend/common/rhnApache.py | 8
backend/common/rhnCache.py | 11
backend/common/rhnConfig.py | 144 ++++----
backend/common/rhnException.py | 9
backend/common/rhnFlags.py | 9
backend/common/rhnLib.py | 5
backend/common/rhnTranslate.py | 18 -
backend/db-checker.py | 5
backend/rhn-conf/rhn_server_iss.conf | 2
backend/satellite_tools/disk_dumper/dumper.py | 25 -
backend/satellite_tools/disk_dumper/iss.py | 2
backend/server/Makefile | 2
backend/server/rhnDatabaseCache.py | 285 -----------------
backend/server/rhnLib.py | 4
backend/server/test/test_rhnDatabaseCache.py | 68 ----
backend/server/test/unit-test/Makefile | 1
backend/server/test/unit-test/test_rhnDatabaseCache.py | 56 ---
backend/spacewalk-backend.spec | 8
rel-eng/packages/spacewalk-backend | 2
21 files changed, 134 insertions(+), 548 deletions(-)
---
12 years, 9 months
backend/spacewalk-backend.spec rel-eng/packages
by Michael Mraka
backend/spacewalk-backend.spec | 7 ++++++-
rel-eng/packages/spacewalk-backend | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
New commits:
commit 8294511320416ae5848ae1d59ee1fef2ebf80cb6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 30 23:20:07 2010 +0100
Automatic commit of package [spacewalk-backend] release [1.3.36-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 0292707..9416602 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -11,7 +11,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2 and Python
-Version: 1.3.35
+Version: 1.3.36
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -683,6 +683,11 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Thu Dec 30 2010 Michael Mraka <michael.mraka(a)redhat.com> 1.3.36-1
+- fixed a lot of pylint woarnings and errors
+- removed dead rhnDatabaseCache
+- Allow clients to retrieve debian packages
+
* Sun Dec 26 2010 Jan Pazdziora 1.3.35-1
- 619083 - we will try not to stringify the types.IntType and types.FloatType.
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index ac747c0..d25ec58 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-1.3.35-1 backend/
+1.3.36-1 backend/
12 years, 9 months
40 commits - backend/common backend/db-checker.py backend/rhn-conf backend/satellite_tools backend/server backend/spacewalk-backend.spec
by Michael Mraka
backend/common/UserDictCase.py | 16
backend/common/apache.py | 2
backend/common/rhnApache.py | 8
backend/common/rhnCache.py | 11
backend/common/rhnConfig.py | 144 ++++----
backend/common/rhnException.py | 9
backend/common/rhnFlags.py | 9
backend/common/rhnLib.py | 5
backend/common/rhnTranslate.py | 18 -
backend/db-checker.py | 5
backend/rhn-conf/rhn_server_iss.conf | 2
backend/satellite_tools/disk_dumper/dumper.py | 25 -
backend/satellite_tools/disk_dumper/iss.py | 2
backend/server/Makefile | 2
backend/server/rhnDatabaseCache.py | 285 -----------------
backend/server/test/test_rhnDatabaseCache.py | 68 ----
backend/server/test/unit-test/Makefile | 1
backend/server/test/unit-test/test_rhnDatabaseCache.py | 56 ---
backend/spacewalk-backend.spec | 1
19 files changed, 125 insertions(+), 544 deletions(-)
New commits:
commit e833739bc076a6d31e6fc22a355c89df7703a394
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 23 00:29:34 2010 +0100
fixed E:183:XML_Dumper.dump_channel_families: Instance of 'XML_Dumper' has no 'channel_ids' member
E:183:XML_Dumper.dump_channel_families: Instance of 'XML_Dumper' has no 'channel_ids_for_families' member
diff --git a/backend/satellite_tools/disk_dumper/dumper.py b/backend/satellite_tools/disk_dumper/dumper.py
index a0aea05..fdde6d8 100644
--- a/backend/satellite_tools/disk_dumper/dumper.py
+++ b/backend/satellite_tools/disk_dumper/dumper.py
@@ -36,6 +36,9 @@ class XML_Dumper:
select cf.id channel_family_id, to_number(null, null) quantity
from rhnChannelFamily cf
"""
+ self.channel_ids = []
+ self.channel_ids_for_families = []
+
def send(self, data):
# to be overwritten in subclass
pass
diff --git a/backend/satellite_tools/disk_dumper/iss.py b/backend/satellite_tools/disk_dumper/iss.py
index 7557a5f..827e9ed 100644
--- a/backend/satellite_tools/disk_dumper/iss.py
+++ b/backend/satellite_tools/disk_dumper/iss.py
@@ -197,7 +197,6 @@ class Dumper(dumper.XML_Dumper):
#self.channel_ids contains the list of dictionaries that hold the channel information
#The keys are 'channel_id', 'label', and 'last_modified'.
- self.channel_ids = []
self.channel_comps = {}
#Channel_labels should be the list of channels passed into rhn-satellite-exporter by the user.
@@ -221,7 +220,6 @@ class Dumper(dumper.XML_Dumper):
# that are already on disk, so that we do not lose those families with
# "incremental" dumps. So we will gather list of channel ids for channels already
# in dump.
- self.channel_ids_for_families = []
channel_labels_for_families = self.fm.filemap['channels'].list()
print "Appending channels %s" % ( channel_labels_for_families )
for ids in channel_labels_for_families:
commit a8c25ae05e95e3dd19eba7a27124089ccd3592f1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 23 00:16:21 2010 +0100
fixed E:442:XML_Dumper._validate_channels: Too many arguments for format string
diff --git a/backend/satellite_tools/disk_dumper/dumper.py b/backend/satellite_tools/disk_dumper/dumper.py
index 9591905..a0aea05 100644
--- a/backend/satellite_tools/disk_dumper/dumper.py
+++ b/backend/satellite_tools/disk_dumper/dumper.py
@@ -437,9 +437,9 @@ class XML_Dumper:
if not (iss_slave_sha256_capable
or all_channels_hash[label]['checksum_type'] in [None, 'sha1']):
raise rhnFault(3001,
- "Channel %s has incompatible rpm checksum (%s). Please contact\n"
+ ("Channel %s has incompatible rpm checksum (%s). Please contact\n"
+ "Red Hat support for information about upgrade to newer version\n"
- + "of Satellite Server which supports it." %
+ + "of Satellite Server which supports it.") %
(label, all_channels_hash[label]['checksum_type']))
channels[label] = all_channels_hash[label]
commit 04d4f4cfa0484b9636bc0980431f922922a3a755
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 23 00:09:59 2010 +0100
use_database_cache is meaningless after rhnDatabaseCache removal
diff --git a/backend/rhn-conf/rhn_server_iss.conf b/backend/rhn-conf/rhn_server_iss.conf
index cdc226a..d6db22c 100644
--- a/backend/rhn-conf/rhn_server_iss.conf
+++ b/backend/rhn-conf/rhn_server_iss.conf
@@ -7,8 +7,6 @@
# newest XML dump version we can import
xml_dump_version = 3.6
-use_database_cache = 0
-
sat_cert_generation = 2
# Completely disable ISS.
diff --git a/backend/satellite_tools/disk_dumper/dumper.py b/backend/satellite_tools/disk_dumper/dumper.py
index 0bec00f..9591905 100644
--- a/backend/satellite_tools/disk_dumper/dumper.py
+++ b/backend/satellite_tools/disk_dumper/dumper.py
@@ -607,8 +607,6 @@ class CachedDumper(exportLib.BaseDumper):
iterator = CachedQueryIterator(statement, params,
cache_get=self.cache_get)
exportLib.BaseDumper.__init__(self, writer, data_iterator=iterator)
- self.use_database_cache = CFG.USE_DATABASE_CACHE
- log_debug(1, "Use database cache", self.use_database_cache)
self.non_cached_class = self.__class__.__bases__[1]
def _get_last_modified(self, params):
commit 1ba795e6049e730605c25a89468f56e775884ef9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 23 00:07:50 2010 +0100
removed tests of dead rhnDatabaseCache
diff --git a/backend/server/test/test_rhnDatabaseCache.py b/backend/server/test/test_rhnDatabaseCache.py
deleted file mode 100644
index efb4857..0000000
--- a/backend/server/test/test_rhnDatabaseCache.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# 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
-# 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 sys
-from spacewalk.common import initLOG
-from spacewalk.server import rhnSQL, rhnDatabaseCache
-
-if __name__ == '__main__':
- initLOG("stderr", 4)
- #connect_string = "misa01/misa01@misa01"
- connect_string = "rhnuser/rhnuser@webdev"
- #connect_string = "rhnuser/rhnuser@webqa"
- #rhnDatabaseCache.initDB(connect_string)
- rhnSQL.initDB(connect_string)
-
- key = 'xml-packages/27/rhn-package-78527.xml-alt'
- ts = 1056359720.0
- #key = 'xml-packages/27/rhn-package-78527.xml'
- if 1:
- if 1:
- data = rhnDatabaseCache.get(key, compressed=1, raw=1, modified=ts)
- else:
- data = rhnDatabaseCache.get(key, compressed=1, raw=1)
- if data is not None:
- print len(data)
- sys.exit(1)
- if 1:
- content = open("test/rhn-package-78527.xml").read() * 6
- if 1:
- rhnDatabaseCache.set(key, content, compressed=1, raw=1, modified=ts)
- else:
- rhnDatabaseCache.set(key, content, compressed=1, raw=1)
- sys.exit(1)
-
- #ts = None
- compressed = 1
- print "Original timestamp:", ts
- print "Has_key ts", rhnDatabaseCache.has_key('b', ts)
- if ts:
- print "Has_key ts-1", rhnDatabaseCache.has_key('b', ts-1)
- if 0:
- #val = '0123456789' * 5000
- #val = open("/tmp/ggg.fff").read()
- #val = '0123456789' * 1024 * 100 * 48
- val = '0123456789' * 1024 * 100 * 30
- rhnDatabaseCache.set('b', val, raw=1, modified=ts,
- compressed=compressed)
- else:
- v = rhnDatabaseCache.get('b', raw=1, compressed=compressed,
- modified=ts)
- if v is None:
- print None
- else:
- print len(v)
- if 0:
- rhnDatabaseCache.delete('b')
-
diff --git a/backend/server/test/unit-test/Makefile b/backend/server/test/unit-test/Makefile
index 60e7a18..09eeb17 100644
--- a/backend/server/test/unit-test/Makefile
+++ b/backend/server/test/unit-test/Makefile
@@ -4,7 +4,6 @@ DB_TESTS = \
test_misc_functions.py \
test_rhnActivationKey.py \
test_rhnChannel.py \
- test_rhnDatabaseCache.py \
test_rhnServerGroup.py \
test_server_registration.py
diff --git a/backend/server/test/unit-test/test_rhnDatabaseCache.py b/backend/server/test/unit-test/test_rhnDatabaseCache.py
deleted file mode 100644
index d187d49..0000000
--- a/backend/server/test/unit-test/test_rhnDatabaseCache.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/python
-#
-# 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
-# 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.
-#
-#
-#
-#
-# $Id$
-
-import os
-import sys
-import unittest
-from spacewalk.server import rhnSQL, rhnDatabaseCache
-
-DB = 'rhnuser/rhnuser@webdev'
-
-
-class Tests(unittest.TestCase):
-
- def setUp(self):
- rhnSQL.initDB(DB)
-
- def tearDown(self):
- # Roll back any unsaved data
- rhnSQL.rollback()
-
- def get_content(self):
- filename = os.path.join(os.path.dirname(sys.argv[0]),
- "rhn-package-78527.xml")
- return open(filename).read() * 100
-
- def test_insert_1(self):
- key = 'xml-packages/27/rhn-package-78527.xml-alt'
- ts = 1056359720.0
-
- content = "0123456789" * 100
-
- rhnDatabaseCache.set(key, content, modified=ts, raw=1, compressed=1)
-
- val = rhnDatabaseCache.get(key, modified=ts, raw=1, compressed=1)
- self.assertEqual(val, content)
-
-
-if __name__ == '__main__':
- sys.exit(unittest.main() or 0)
commit 866911a7aab43e106553bb5fa97d60613a9feb63
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 23 00:06:17 2010 +0100
removed dead rhnDatabaseCache from build scripts
diff --git a/backend/server/Makefile b/backend/server/Makefile
index 96eb416..13c7576 100644
--- a/backend/server/Makefile
+++ b/backend/server/Makefile
@@ -13,7 +13,7 @@ SPACEWALK_FILES = __init__ \
apacheServer apacheHandler apacheAuth apacheRequest \
apacheUploadServer \
configFilesHandler \
- rhnAuthPAM rhnCapability rhnChannel rhnDatabaseCache \
+ rhnAuthPAM rhnCapability rhnChannel \
rhnDependency \
rhnAction \
rhnHandler rhnImport rhnMapping rhnLib rhnPackage \
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index f4a744f..0292707 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -408,7 +408,6 @@ rm -f %{rhnconf}/rhnSecret.py*
%{pythonrhnroot}/server/rhnCapability.py*
%{pythonrhnroot}/server/rhnChannel.py*
%{pythonrhnroot}/server/rhnKickstart.py*
-%{pythonrhnroot}/server/rhnDatabaseCache.py*
%{pythonrhnroot}/server/rhnDependency.py*
%{pythonrhnroot}/server/rhnPackage.py*
%{pythonrhnroot}/server/rhnPackageUpload.py*
commit e734a585d02a65ea29495b8a4f397c98274b6f9b
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 23 00:04:21 2010 +0100
removed usage of dead rhnDatabaseCache from other modules
diff --git a/backend/satellite_tools/disk_dumper/dumper.py b/backend/satellite_tools/disk_dumper/dumper.py
index 966c9dc..0bec00f 100644
--- a/backend/satellite_tools/disk_dumper/dumper.py
+++ b/backend/satellite_tools/disk_dumper/dumper.py
@@ -21,7 +21,7 @@ from cStringIO import StringIO
from spacewalk.common import log_debug, log_error, rhnFault, rhnCache, \
CFG, rhnLib, rhnFlags
-from spacewalk.server import rhnSQL, rhnDatabaseCache
+from spacewalk.server import rhnSQL
from spacewalk.satellite_tools import constants
from spacewalk.satellite_tools.exporter import exportLib, xmlWriter
from string_buffer import StringBuffer
@@ -624,21 +624,14 @@ class CachedDumper(exportLib.BaseDumper):
log_debug(4, params)
key = self._get_key(params)
last_modified = self._get_last_modified(params)
- if not self.use_database_cache:
- return rhnCache.get(key, modified=last_modified, raw=1)
- return rhnDatabaseCache.get(key, modified=last_modified, raw=1,
- compressed=1)
+ return rhnCache.get(key, modified=last_modified, raw=1)
def cache_set(self, params, value):
log_debug(4, params)
last_modified = self._get_last_modified(params)
key = self._get_key(params)
- if not self.use_database_cache:
- set_cache = rhnCache.set(key, value, modified=last_modified, \
+ return rhnCache.set(key, value, modified=last_modified, \
raw=1, user='apache', group='apache', mode=0755)
- return set_cache
- return rhnDatabaseCache.set(key, value, modified=last_modified, raw=1,
- compressed=1)
def dump_subelement(self, data):
log_debug(2)
commit a42d4283ed31bec5a882dbdaa9528211e96f7285
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Dec 22 23:51:38 2010 +0100
removed dead module
* there is no rhnCache table so _fetch_cursor() and set() have to be dead
* there is also no lookup_cache_key() pl/sql function so set() have to
be even more dead
* neither rhn_cache_delete() pl/sql proc so delete() is dead
* and no rhn_cache_update_accessed() pl/sql proc so get() is dead
* so there is only has_key() left but it uses _fetch_cursor() so it have
to be dead also
* to sum up: No One Here Gets Out Alive
diff --git a/backend/server/rhnDatabaseCache.py b/backend/server/rhnDatabaseCache.py
deleted file mode 100644
index 6849916..0000000
--- a/backend/server/rhnDatabaseCache.py
+++ /dev/null
@@ -1,285 +0,0 @@
-#
-# 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
-# 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 math
-import gzip
-import string
-import cPickle
-import cStringIO
-
-from spacewalk.common import rhnCache, log_debug, log_error
-from spacewalk.common.rhnLib import timestamp
-
-from spacewalk.server import rhnSQL
-
-# XXX Although it would have been much easier to do it all in python, we want
-# this code to commit as soon as possible. Also, we cannot just commit
-# ourselves, there may be data outside of this module that wasn't committed
-# yet, and that may have to be rolled back at a later point. The only solution
-# is using stored procedures that are marked as doing autonomous transactions.
-# Such procedures don't see the changes in the same transaction, and commiting
-# doesn't commit the outer transaction.
-
-### The following functions expose this module as a dictionary
-
-def has_key(name, modified = None):
- # We have to rely on the same entity generating the time and comparing it;
- # we are generating UNIX timestamps on the app side, and we store them in
- # the database as DATE fields. The trick is to make both conversions in
- # the same way.
- # One second differences seem to be returned as zero, presumably because
- # 1 means one day for Oracle; 1/86400 is silently converted by DCOracle to
- # 0, which is bad; so scale the response to number_of_seconds instead of
- # days.
-
- # Even though we set now as time.time(), we don't actually use it; the
- # database will set its own time if modified is not specified; in this
- # case we only need a placeholder value so that the query can correctly
- # compute the time delta
- h = _fetch_cursor(key=name, modified=modified)
-
- row = h.fetchone_dict()
- if not row:
- # Key not found
- return 0
-
- # has_key behaves as stat(): the access time doesn't change just by
- # poking around to see if the key is there
-
- if modified and row['delta'] != 0:
- # Different version
- return 0
- # Same copy
- return 1
-
-def get(name, modified = None, raw = None, compressed = None):
- # Check to see if the entry is in the database, with the right version
- h = _fetch_cursor(key=name, modified=modified)
-
- row = h.fetchone_dict()
-
- if not row:
- # Key not found
- return None
-
- if modified and row['delta'] != 0:
- # Different version
- log_debug(4, "database cache: different version")
- return None
-
- if modified is None:
- # The caller doesn't care about the modified time, but we do, since we
- # want to fetch the same version from the disk cache
- modified = row['modified']
-
- if rhnCache.has_key(name, modified):
- # We have the value
- log_debug(4, "Filesystem cache HIT")
- return rhnCache.get(name, modified=modified, raw=raw)
-
- log_debug(4, "Filesystem cache MISS")
-
- # The disk cache doesn't have this key at all, or it's a modified value
- # Fetch the value from the database
-
- v = row['value']
- # Update the accessed field
- rhnSQL.Procedure("rhn_cache_update_accessed")(name)
-
- if compressed:
- io = cStringIO.StringIO()
-
- io.write(rhnSQL.read_lob(v))
- io.seek(0, 0)
-
- # XXX For about 40M of compressed data sometimes we get:
- # zlib.error: Error -3 while decompressing: incomplete dynamic bit lengths tree
- v = gzip.GzipFile(None, "r", 0, io)
-
- try:
- data = v.read()
- except (ValueError, IOError, gzip.zlib.error), e:
- # XXX poking at gzip.zlib may not be that well-advised
- log_error("rhnDatabaseCache: gzip error for key %s: %s" % (
- name, e))
- # Ignore this entry in the database cache, it has invalid data
- return None
-
- # We store the data in the database cache, in raw format
- rhnCache.set(name, data, modified=modified, raw=1)
-
- # Unpickle the data, unless raw access was requested
- if not raw:
- return cPickle.loads(data)
-
- return data
-
-
-def delete(name):
- # Uses the stored procedure. Quite simple
- rhnSQL.Procedure("rhn_cache_delete")(name)
- # Delete it from the disk cache too, just in case
- rhnCache.delete(name)
-
-# We only set the database cache value
-# The local disk one will be cached when get() is called for the first time
-def set(name, value, modified = None, raw = None, compressed = None):
- if modified is not None:
- modified = timestamp(modified)
- if raw:
- val = value
- else:
- val = cPickle.dumps(value, 1)
-
- if compressed:
- # Since most of the data is kept in memory anyway, don't bother to
- # write it to a temp file at this point - it's probably much smaller
- # anyway
- io = cStringIO.StringIO()
-
- f = gzip.GzipFile(None, "w", 5, io)
- f.write(val)
- f.close()
-
- val = io.getvalue()
- io.close()
-
- data_length = len(val)
- chunk_size = 32512
- chunks = int(math.ceil(float(data_length) / chunk_size))
- #if chunks > 256:
- # raise Exception, "Data too big"
-
- plsql_template = r"""
-DECLARE
- PRAGMA AUTONOMOUS_TRANSACTION;
- blob_val BLOB;
- modified_date DATE;
- now DATE := sysdate;
- our_key_id number;
-%s
-BEGIN
- our_key_id := lookup_cache_key(:key);
- BEGIN
- SELECT value INTO blob_val
- FROM rhnCache
- WHERE key_id = our_key_id
- FOR UPDATE OF value;
- EXCEPTION
- WHEN NO_DATA_FOUND THEN
- -- The entry is not here yet, let's create it
- INSERT INTO rhnCache (key_id, value, created, modified)
- VALUES (our_key_id, EMPTY_BLOB(), sysdate, sysdate)
- RETURNING value INTO blob_val;
- END;
- -- If we want to write less data than currently available, trim the blob
- IF :data_len < DBMS_LOB.getlength(blob_val) THEN
- DBMS_LOB.TRIM(blob_val, :data_len);
- END IF;
-
-%s
-
- -- Now update last_modified and last_accessed
- if :modified IS NULL THEN
- modified_date := now;
- ELSE
- modified_date := TO_DATE('1970-01-01 00:00:00',
- 'YYYY-MM-DD HH24:MI:SS') + :modified / 86400;
- END IF;
- UPDATE rhnCache SET modified = modified_date WHERE key_id = our_key_id;
- -- Update accessed too
- UPDATE rhnCacheTimestamps
- SET accessed = now
- WHERE key_id = our_key_id;
- if SQL%%ROWCOUNT = 0 THEN
- -- No entry in rhnCacheTimestamps; insert it
- INSERT INTO rhnCacheTimestamps (key_id, accessed)
- VALUES (our_key_id, now);
- END IF;
- COMMIT;
-END;
-"""
-
- decl_template = " arg_%s LONG RAW := :val_%s;"
- dbms_lob_template = " DBMS_LOB.WRITE(blob_val, %s, %s, arg_%s);"
-
- indices = range(chunks)
- start_pos = map(lambda x, cs=chunk_size: x * cs + 1, indices)
- sizes = [ chunk_size ] * (chunks - 1) + \
- [ 'length(rawtohex(arg_%s)) / 2' % (chunks - 1) ]
-
- query = plsql_template % (
- string.join(
- map(lambda x, y, t=decl_template: t % (x, y),
- indices, indices),
- "\n"
- ),
- string.join(
- map(lambda x, y, z, t=dbms_lob_template: t % (x, y, z),
- sizes, start_pos, indices),
- "\n"
- ),
- )
- params = {
- 'modified' : modified,
- 'data_len' : data_length,
- 'key' : name,
- }
- for i in indices:
- start = i * chunk_size
- end = (i + 1) * chunk_size
- params['val_%s' % i] = rhnSQL.types.LONG_BINARY(val[start:end])
-
- h = rhnSQL.prepare(query)
- tries = 3
- while tries:
- tries = tries - 1
- try:
- apply(h.execute, (), params)
- except rhnSQL.SQLSchemaError, e:
- if e.errno == 1:
- # Unique constraint violated - probably someone else was
- # doing the same thing at the same time
- # Try again
- continue
- # No errors - we're done
- # We're done
- break
- else:
- # Kept raising Unique constraint violated - something else may be
- # wrong; re-raise the last exception
- raise
-
-def _fetch_cursor(key=None, modified=None):
- if modified is not None:
- modified = timestamp(modified)
-
- # Computing the number of seconds since Jan 1 1970
-
- h = rhnSQL.prepare("""
- select c.key_id, c.value, nvl(
- (c.modified -
- TO_DATE('1970-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')) *
- 86400 - :modified,
- 0) delta,
- (c.modified - TO_DATE('1970-01-01 00:00:00',
- 'YYYY-MM-DD HH24:MI:SS')) * 86400 modified
- from rhnCache c
- where c.key_id = LOOKUP_CACHE_KEY(:key)
- """)
- h.execute(key=key, modified=modified)
- return h
-
commit eb3df621f5d9da09c7326b4f7c1f9f75f2bcea65
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Dec 22 23:42:19 2010 +0100
fixed E1101:616:CachedDumper._get_key: Instance of 'CachedDumper' has no 'item_id_key' member
E1101:617:CachedDumper._get_key: Instance of 'CachedDumper' has no 'hash_factor' member
E1101:618:CachedDumper._get_key: Instance of 'CachedDumper' has no 'key_template' member
diff --git a/backend/satellite_tools/disk_dumper/dumper.py b/backend/satellite_tools/disk_dumper/dumper.py
index ffd658b..966c9dc 100644
--- a/backend/satellite_tools/disk_dumper/dumper.py
+++ b/backend/satellite_tools/disk_dumper/dumper.py
@@ -599,6 +599,9 @@ class CachedQueryIterator:
class CachedDumper(exportLib.BaseDumper):
iterator_query = None
+ item_id_key = 'id'
+ hash_factor = 1
+ key_template = 'dump/%s/dump-%s.xml'
def __init__(self, writer, params):
statement = rhnSQL.prepare(self.iterator_query)
iterator = CachedQueryIterator(statement, params,
commit b7a413a8cdc2a60fd9943d97047ffc4d6c7e7bb2
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Nov 29 22:12:15 2010 +0100
fixed W0402: 20: Uses of a deprecated module 'string'
diff --git a/backend/db-checker.py b/backend/db-checker.py
index ff3a40b..e5a126c 100755
--- a/backend/db-checker.py
+++ b/backend/db-checker.py
@@ -17,7 +17,6 @@
import os
import sys
import types
-import string
from optparse import OptionParser, Option
_topdir = os.path.abspath(os.path.dirname(sys.argv[0]))
@@ -61,7 +60,7 @@ def main():
print "Unable to import module %s: %s" % (module_name, e)
continue
- comps = string.split(pmn, '.')
+ comps = pmn.split('.')
for c in comps[1:]:
m = getattr(m, c)
@@ -76,7 +75,7 @@ def proper_module_name(module_name):
if module_name.endswith(suffix):
module_name = module_name[:-len(suffix)]
- return string.replace(os.path.normpath(module_name), '/', '.')
+ return os.path.normpath(module_name).replace('/', '.')
_objs_seen = {}
commit 54592cb76802910fb55bf8026feb7dc4a25b7515
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Nov 29 10:12:17 2010 +0100
fixed W0402: 19: Uses of a deprecated module 'string'
diff --git a/backend/common/rhnFlags.py b/backend/common/rhnFlags.py
index 5aa5a18..d16acc9 100644
--- a/backend/common/rhnFlags.py
+++ b/backend/common/rhnFlags.py
@@ -16,9 +16,6 @@
#
-import string
-
-
def set(name, value = 1):
"""
set value
@@ -27,7 +24,7 @@ def set(name, value = 1):
global __F
if not name:
return None
- name = string.lower(name)
+ name = name.lower()
try:
__F[name] = value
except NameError:
@@ -42,7 +39,7 @@ def get(name):
global __F
if not name:
return None
- name = string.lower(name)
+ name = name.lower()
try:
return __F.get(name)
except NameError:
@@ -57,7 +54,7 @@ def test(name):
global __F
if not name:
return 0
- name = string.lower(name)
+ name = name.lower()
try:
return __F.has_key(name) and __F[name]
except NameError:
commit 41712f4e7d454bd3c41bc8beea804d0c113beaa3
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 23:18:59 2010 +0100
fixed W0612: 65:rfc822time: Unused variable 'tm_isdst' W0612: 65:rfc822time: Unused variable 'tm_yday'
diff --git a/backend/common/rhnLib.py b/backend/common/rhnLib.py
index 84e4226..9d3d347 100644
--- a/backend/common/rhnLib.py
+++ b/backend/common/rhnLib.py
@@ -61,7 +61,7 @@ def rfc822time(arg):
# Now, the arg must be a float.
(tm_year, tm_mon, tm_mday, tm_hour, tm_min, \
- tm_sec, tm_wday, tm_yday, tm_isdst) = time.gmtime(arg)
+ tm_sec, tm_wday, _tm_yday_, _tm_isdst_) = time.gmtime(arg)
return \
"%s, %02d %s %04d %02d:%02d:%02d %s" % \
commit 0b5ee85414a4b6848f2068e3d6e1d74faa0c702f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 23:18:10 2010 +0100
fixed W0402: 18: Uses of a deprecated module 'string'
diff --git a/backend/common/rhnLib.py b/backend/common/rhnLib.py
index df5b038..84e4226 100644
--- a/backend/common/rhnLib.py
+++ b/backend/common/rhnLib.py
@@ -15,7 +15,6 @@
import time
import types
-import string
import urlparse
def setHeaderValue(mp_table, name, values):
@@ -149,7 +148,7 @@ def hash_object_id(object_id, factor):
last few digits for the number. For instance, (812345, 3) should
return 345"""
# Grab the digits after -
- num_id = string.split(object_id, '-')[-1]
+ num_id = object_id.split('-')[-1]
# get last 'factor' numbers
num_id = num_id[-factor:]
return num_id.rjust(factor,'0')
commit 8c2e86f24dee63fbcaac63d833cf7a33ca330d37
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 23:11:43 2010 +0100
fixed W0212:685:initCFG: Access to a protected member _init of a client class
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index ee1b835..6c6b786 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -66,9 +66,9 @@ class RHNOptions:
# NOTE: root: root directory location of config files.
self.root = None
self.filename = None
- self._init(component, root, filename)
+ self.init(component, root, filename)
- def _init(self, component, root=None, filename=None):
+ def init(self, component, root=None, filename=None):
"""
Visible function, so that we can re-init the object without
losing the reference to it
@@ -681,7 +681,7 @@ def initCFG(component=None, root=None, filename=None):
"""
# NOTE: root: root directory location of config files.
global CFG
- CFG._init(component, root, filename)
+ CFG.init(component, root, filename)
CFG.parse()
commit 802e9dc617088b5717aec51d2b92385c506494e7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 23:09:46 2010 +0100
fixed W0212:705:runTest: Access to a protected member _getDefaults of a client class W0212:716:runTest: Access to a protected member _showall of a client class
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index 02f2a6d..ee1b835 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -413,7 +413,7 @@ class RHNOptions:
### protected/test methods
- def _getDefaults(self):
+ def getDefaults(self):
"""returns the __defaults dict (dictionary of parsed defaults).
"""
self.__check()
@@ -433,7 +433,7 @@ class RHNOptions:
self.__check()
return self.__configs
- def _showall(self):
+ def showall(self):
from pprint import pprint
print "__defaults: dictionary of parsed defaults."
pprint(self.__defaults)
@@ -701,7 +701,7 @@ def runTest():
print "=============== the object's repr ================================"
print test_cfg
print "=============== the object's defaults ============================"
- pprint.pprint(test_cfg._getDefaults())
+ pprint.pprint(test_cfg.getDefaults())
print "=============== an erronous lookup example ======================="
print "testing __getattr__"
try:
@@ -712,7 +712,7 @@ def runTest():
print "=============== the object's merged settings ======================"
test_cfg.show()
print "=============== dump of all relevant dictionaries ================="
- test_cfg._showall()
+ test_cfg.showall()
print "==================================================================="
# confDict = {
# 'traceback_mail': 'testing(a)here.com, test2(a)here.com',
commit 35cedbc1718aefd937b33ad381cc1003de3577b9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 23:08:36 2010 +0100
fixed W0621:695:runTest: Redefining name 'cfg' from outer scope (line 778)
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index 0c5ecfa..02f2a6d 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -691,28 +691,28 @@ def runTest():
print "Component tree of all installed components:"
pprint.pprint(getAllComponents_tree())
print
- cfg = RHNOptions(sys.argv[1])
-# cfg = RHNOptions('server.app')
-# cfg = RHNOptions('proxy.broker')
-# cfg = RHNOptions('proxy.redirect', _CONFIG_ROOT)
-# cfg = RHNOptions('proxy.redirect', '/tmp')
-# cfg.filename = 'empty.conf'
- cfg.parse()
+ test_cfg = RHNOptions(sys.argv[1])
+# test_cfg = RHNOptions('server.app')
+# test_cfg = RHNOptions('proxy.broker')
+# test_cfg = RHNOptions('proxy.redirect', _CONFIG_ROOT)
+# test_cfg = RHNOptions('proxy.redirect', '/tmp')
+# test_cfg.filename = 'empty.conf'
+ test_cfg.parse()
print "=============== the object's repr ================================"
- print cfg
+ print test_cfg
print "=============== the object's defaults ============================"
- pprint.pprint(cfg._getDefaults())
+ pprint.pprint(test_cfg._getDefaults())
print "=============== an erronous lookup example ======================="
print "testing __getattr__"
try:
- print cfg.lkasjdfxxxxxxxxxxxxxx
+ print test_cfg.lkasjdfxxxxxxxxxxxxxx
except AttributeError, e:
print 'Testing: "AttributeError: %s"' % e
print
print "=============== the object's merged settings ======================"
- cfg.show()
+ test_cfg.show()
print "=============== dump of all relevant dictionaries ================="
- cfg._showall()
+ test_cfg._showall()
print "==================================================================="
# confDict = {
# 'traceback_mail': 'testing(a)here.com, test2(a)here.com',
@@ -750,7 +750,7 @@ def runTest():
'server.satellite.rhn_parent': "RHN 'parent' server of this satellite",
'server.BLAH': "TESTING... SHOULD NEVER WRITE THIS COMMENT!",
}
- cfg.writeConfig(confDict, commentDict, stream=sys.stdout)
+ test_cfg.writeConfig(confDict, commentDict, stream=sys.stdout)
#------------------------------------------------------------------------------
commit 2bed987dee3c86bf07507318da6e58ce5161eda9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 23:05:59 2010 +0100
fixed C0322:646:getAllComponents_tree: Operator not preceded by a space d[key]={} ^
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index b90cbbd..0c5ecfa 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -642,7 +642,7 @@ def getAllComponents_tree(defaultDir=None):
for i in range(len(parts)):
key = '.'.join(parts[:i+1])
if not d.has_key(key):
- d[key]={}
+ d[key] = {}
d = d[key]
return compTree
commit 3536c67f42aec842634cdc2cfccaa7371527aeaa
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 23:05:11 2010 +0100
fixed W0201: 78:RHNOptions._init: Attribute 'filename' defined outside __init__ W0201: 80:RHNOptions._init: Attribute 'root' defined outside __init__
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index 037c463..b90cbbd 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -64,6 +64,8 @@ class RHNOptions:
# Last modification date for the config file
self.__timestamp = 0
# NOTE: root: root directory location of config files.
+ self.root = None
+ self.filename = None
self._init(component, root, filename)
def _init(self, component, root=None, filename=None):
commit b8037ae1d67f79be86b5c4ec6265fa15ee2328f1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 23:03:52 2010 +0100
fixed W0612:401:RHNOptions.__merge: Unused variable 'lineno' W0511:402: XXX: we don't really want to force every item in the
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index 34d622b..037c463 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -397,8 +397,8 @@ class RHNOptions:
if not self.__parsedConfig.has_key(comp):
# No such entry in the config file
continue
- for key, (values, lineno) in self.__parsedConfig[comp].items():
- ## XXX: we don't really want to force every item in the
+ for key, (values, _lineno_) in self.__parsedConfig[comp].items():
+ ## we don't really want to force every item in the
## config file to have a default value first. If we do,
## uncomment this section
#if not opts.has_key(key): # Unknown keyword
commit e5b45176893dc27f9d253070dbda10694f7aed4b
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 22:58:09 2010 +0100
fixed W0621:180:RHNOptions.has_key: Redefining name 'key' from outer scope (line 762) W0621:192:RHNOptions.set: Redefining name 'key' from outer scope (line 762) W0621:227:RHNOptions.writeConfig: Redefining name 'key' from outer scope (line 762) W0621:321:RHNOptions.__getattr__: Redefining name 'key' from outer scope (line 762) W0621:358:RHNOptions.get: Redefining name 'key' from outer scope (line 762) W0621:400:RHNOptions.__merge: Redefining name 'key' from outer scope (line 762) W0621:469:parse_line.sanitize_value: Redefining name 'key' from outer scope (line 762) W0621:531:unparse_line: Redefining name 'key' from outer scope (line 762) W0621:586:parse_file: Redefining name 'key' from outer scope (line 762) W0621:641:getAllComponents_tree: Redefining name 'key' from outer scope (line 762)
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index cb1c28b..34d622b 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -759,11 +759,11 @@ def runTest():
if __name__ == "__main__":
do_list = 0
comp_arg = None
- key = None
+ key_arg = None
if len(sys.argv) == 4 and sys.argv[1] == "get":
comp_arg = sys.argv[2]
- key = sys.argv[3]
+ key_arg = sys.argv[3]
elif len(sys.argv) == 3 and sys.argv[1] == "list":
comp_arg = sys.argv[2]
do_list = 1
@@ -778,4 +778,4 @@ if __name__ == "__main__":
if do_list:
cfg.show()
else:
- print cfg.get(key)
+ print cfg.get(key_arg)
commit a4615025c6fad4be9fc453adad3479c4909eb6a5
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 22:54:38 2010 +0100
fixed W0621: 82:RHNOptions.setComponent: Redefining name 'comp' from outer scope (line 761) W0621:148:RHNOptions._parseDefaults: Redefining name 'comp' from outer scope (line 761) W0621:243:RHNOptions.writeConfig: Redefining name 'comp' from outer scope (line 761) W0621:270:RHNOptions.diffConfig: Redefining name 'comp' from outer scope (line 761) W0621:389:RHNOptions.__merge: Redefining name 'comp' from outer scope (line 761) W0621:585:parse_file: Redefining name 'comp' from outer scope (line 761) W0621:633:getAllComponents_tree: Redefining name 'comp' from outer scope (line 761) W0621:667:getAllComponents_tuples: Redefining name 'comp' from outer scope (line 761)
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index 056c45d..cb1c28b 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -758,21 +758,21 @@ def runTest():
if __name__ == "__main__":
do_list = 0
- comp = None
+ comp_arg = None
key = None
if len(sys.argv) == 4 and sys.argv[1] == "get":
- comp = sys.argv[2]
+ comp_arg = sys.argv[2]
key = sys.argv[3]
elif len(sys.argv) == 3 and sys.argv[1] == "list":
- comp = sys.argv[2]
+ comp_arg = sys.argv[2]
do_list = 1
else:
# Assume test mode.
runTest()
sys.exit(1)
- cfg = RHNOptions(comp)
+ cfg = RHNOptions(comp_arg)
cfg.parse()
if do_list:
commit 96be8dcdb140f5820b15f0c38b0c49a9eaf54cbc
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 22:48:43 2010 +0100
fixed W0622: 57:RHNOptions.__init__: Redefining built-in 'file' W0622: 71:RHNOptions._init: Redefining built-in 'file' W0622:558:parse_file: Redefining built-in 'file' W0622:597:read_file: Redefining built-in 'file'
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index e90ec65..056c45d 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -52,7 +52,7 @@ class RHNOptions:
component and the configuration tree - across all instances of this
class.
"""
- def __init__(self, component=None, root=None, file=None):
+ def __init__(self, component=None, root=None, filename=None):
self.__component = None
# Defaults for each option, keyed on tuples
self.__defaults = {}
@@ -64,18 +64,18 @@ class RHNOptions:
# Last modification date for the config file
self.__timestamp = 0
# NOTE: root: root directory location of config files.
- self._init(component, root, file)
+ self._init(component, root, filename)
- def _init(self, component, root=None, file=None):
+ def _init(self, component, root=None, filename=None):
"""
Visible function, so that we can re-init the object without
losing the reference to it
"""
if root is None:
root = _CONFIG_ROOT
- self.file = file
- if self.file is None:
- self.file = _CONFIG_FILE
+ self.filename = filename
+ if self.filename is None:
+ self.filename = _CONFIG_FILE
self.setComponent(component)
self.root = root
@@ -95,10 +95,10 @@ class RHNOptions:
"""returns last modified time diff if rhn.conf has changed."""
try:
- si = os.stat(self.file)
+ si = os.stat(self.filename)
except OSError, e:
raise ConfigParserError("config file read error",
- self.file, e.args[1])
+ self.filename, e.args[1])
lm = si[stat.ST_MTIME]
# should always be positive, but a non-zero result is still
# indication that the file has changed.
@@ -131,8 +131,8 @@ class RHNOptions:
self._parseDefaults(allCompsYN=0)
# Now that we parsed the defaults, we parse the multi-key
- # self.file configuration (ie, /etc/rhn/rhn.conf)
- self.__parsedConfig = parse_file(self.file)
+ # self.filename configuration (ie, /etc/rhn/rhn.conf)
+ self.__parsedConfig = parse_file(self.filename)
# And now generate and cache the current component
self.__merge()
@@ -210,7 +210,7 @@ class RHNOptions:
NOTE: *DESTRUCTIVE* will overwrite file always.
"""
if stream is None:
- stream = open(self.file, 'wb')
+ stream = open(self.filename, 'wb')
_dict = {}
# convert to a dict of the sort understood by the object if not
# already converted
@@ -403,7 +403,7 @@ class RHNOptions:
## uncomment this section
#if not opts.has_key(key): # Unknown keyword
# warn("Warning: in file %s, line %s: unknown "
- # "option name `%s'" % (self.file, lineno, key))
+ # "option name `%s'" % (self.filename, lineno, key))
# continue
opts[key] = values
# and now save it
@@ -553,11 +553,11 @@ def unparse_line(component, key, value):
return '%s = %s' % (k, v)
-def parse_file(file, single_key = 0):
+def parse_file(filename, single_key = 0):
"""
parse a config file (read it in, parse its lines)
"""
- lines = read_file(file)
+ lines = read_file(filename)
# the base case, an empty tuple component, is always present.
ret = {(): {}}
lineno = 0
@@ -569,7 +569,7 @@ def parse_file(file, single_key = 0):
(keys, values) = parse_line(line)
except:
raise ConfigParserError("Parse Error: <%s:%s>: '%s'" % (
- file, lineno, line))
+ filename, lineno, line))
if keys is None: # We don't care about this line
continue
# now process the parsed line
@@ -577,7 +577,7 @@ def parse_file(file, single_key = 0):
# Error, we should not have more than one key in the this
# config file
# raise ConfigParserError("Parse Error: <%s:%s>: too many keys"
-# % (file, lineno))
+# % (filename, lineno))
# let's fix the faulty config=file setup...
# XXX: needs more testing!!! (2003-04-17)
del keys[:-1]
@@ -592,12 +592,12 @@ def parse_file(file, single_key = 0):
return ret
-def read_file(file):
+def read_file(filename):
"""
reads a text config file and returns its lines in a list
"""
try:
- lines = open(file, 'rb').readlines()
+ lines = open(filename, 'rb').readlines()
new_lines = []
combined = ''
for line in lines:
@@ -610,7 +610,7 @@ def read_file(file):
combined = combined + line.replace('\\\n', ' ')
return new_lines
except (IOError, OSError), e:
- raise ConfigParserError("Can not read config file", file, e.args[1])
+ raise ConfigParserError("Can not read config file", filename, e.args[1])
def getAllComponents_tree(defaultDir=None):
@@ -673,13 +673,13 @@ def getAllComponents_tuples(defaultDir=None):
CFG = RHNOptions()
-def initCFG(component=None, root=None, file=None):
+def initCFG(component=None, root=None, filename=None):
"""
Main entry point here
"""
# NOTE: root: root directory location of config files.
global CFG
- CFG._init(component, root, file)
+ CFG._init(component, root, filename)
CFG.parse()
@@ -694,7 +694,7 @@ def runTest():
# cfg = RHNOptions('proxy.broker')
# cfg = RHNOptions('proxy.redirect', _CONFIG_ROOT)
# cfg = RHNOptions('proxy.redirect', '/tmp')
-# cfg.file = 'empty.conf'
+# cfg.filename = 'empty.conf'
cfg.parse()
print "=============== the object's repr ================================"
print cfg
commit 7c879a99b374d7325e1fc53be934e66d8daf87f8
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 22:41:40 2010 +0100
fixed W0402: 20: Uses of a deprecated module 'string'
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index 6263482..e90ec65 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -17,7 +17,6 @@ import os
import sys
import glob
import stat
-import string
from UserDictCase import UserDictCase
@@ -30,8 +29,7 @@ def warn(*args):
"""
Function used for debugging purposes
"""
- sys.stderr.write("CONFIG PARSE WARNING: %s\n" % \
- string.join(map(str, args)))
+ sys.stderr.write("CONFIG PARSE WARNING: %s\n" % " ".join(map(str, args)))
class ConfigParserError(Exception):
@@ -156,7 +154,7 @@ class RHNOptions:
conffile = "%s/default/rhn.conf" % (self.root)
if comp:
conffile = "%s/default/rhn_%s.conf" % (self.root,
- string.join(comp, '_'))
+ '_'.join(comp))
# if the file is not there (or can't be read), skip
if not os.access(conffile, os.R_OK):
warn("File not found or can't be read", conffile)
@@ -248,7 +246,7 @@ class RHNOptions:
comment = ""
if comp:
# just for the comment lookup
- k = string.join(comp+(k, ), '.')
+ k = '.'.join(comp+(k, ))
if commentDict.has_key(k):
comment = '# %s\n' % commentDict[k]
# write it
@@ -272,18 +270,18 @@ class RHNOptions:
for comp in configDict.keys():
if comp not in unique:
unique.append(comp)
- possible = parse_comps(string.join(comp, '.'))
+ possible = parse_comps('.'.join(comp))
for c in possible:
if not diffDict.has_key(c):
diffDict[c] = {}
# examine all the components and keys
for comp in unique:
- self.__component = string.join(comp, '.')
+ self.__component = '.'.join(comp)
self._parseDefaults(allCompsYN=0)
if self.__defaults.has_key(comp):
for k in configDict[comp].keys():
- possible = parse_comps(string.join(comp, '.'))
+ possible = parse_comps('.'.join(comp))
keyFoundYN = 0
# is the key at least in the component tree?
for c in possible:
@@ -454,7 +452,7 @@ def parse_comps(component):
# Split the component name on '.'
if not component:
return [()]
- comps = map(string.lower, string.split(component, '.'))
+ comps = [c.lower() for c in component.split('.')]
# Now generate the prefixes for this component
return map(lambda i, a=comps: tuple(a[:i]), range(len(comps)+1))
@@ -479,7 +477,7 @@ def parse_line(line):
'server.satellite.http_proxy_username': str,
'server.satellite.http_proxy_password': str,
'server.satellite.rhn_parent': str}
- val = string.strip(val)
+ val = val.strip()
if converTable.get(key):
try:
@@ -499,33 +497,33 @@ def parse_line(line):
return val
# Strip out any comments.
- i = string.find(line, '#')
+ i = line.find('#')
if i >= 0:
line = line[:i]
- line = string.strip(line)
+ line = line.strip()
if not line:
return (None, None)
# now split it into keys and values. We allow for max one
# split/cut (the first one)
- (keys, vals) = map(string.strip, string.split(line, '=', 1))
+ (keys, vals) = [c.strip() for c in line.split('=', 1)]
# extract the keys, convert to lowercase
- keys = string.lower(keys)
+ keys = keys.lower()
if not keys:
raise ConfigParserError("Missing Key = expression")
# extract the values, preserving case
if not vals:
- keys = string.split(keys, varSeparator)
+ keys = keys.split(varSeparator)
return (keys, None)
# split and sanitize
- vals = map(sanitize_value, [keys]*len(string.split(vals, optSeparator)),
- string.split(vals, optSeparator))
+ vals = map(sanitize_value, [keys]*len(vals.split(optSeparator)),
+ vals.split(optSeparator))
if len(vals) == 1:
# Single value
vals = vals[0]
- keys = string.split(keys, varSeparator)
+ keys = keys.split(varSeparator)
# and now return our findings
return (keys, vals)
@@ -542,13 +540,13 @@ def unparse_line(component, key, value):
k = key
if component:
- k = string.join(component+(k, ), varSeparator)
+ k = varSeparator.join(component+(k, ))
if type(value) == type(()):
# ignore the line number
value = value[0]
v = value
if type(value) == type([]):
- v = string.join(map(str, value), optSeparator + " ")
+ v = (optSeparator + " ").join(map(str, value))
if v is None:
v = ''
v = str(v)
@@ -634,13 +632,13 @@ def getAllComponents_tree(defaultDir=None):
compTree = {}
for comp in comps:
comp = os.path.basename(comp)
- comp = comp[:string.find(comp, '.')] # left of .conf
- parts = string.split(comp, '_')[1:] # strip off that rhn_
+ comp = comp[:comp.find('.')] # left of .conf
+ parts = comp.split('_')[1:] # strip off that rhn_
if not parts:
continue
d = compTree
for i in range(len(parts)):
- key = string.join(parts[:i+1], '.')
+ key = '.'.join(parts[:i+1])
if not d.has_key(key):
d[key]={}
d = d[key]
commit 304d89462e0c091520ac343c2377aa7529864e20
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 22:23:38 2010 +0100
fixed W0622:762: Redefining built-in 'list'
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index 2569932..6263482 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -759,7 +759,7 @@ def runTest():
if __name__ == "__main__":
- list = 0
+ do_list = 0
comp = None
key = None
@@ -768,7 +768,7 @@ if __name__ == "__main__":
key = sys.argv[3]
elif len(sys.argv) == 3 and sys.argv[1] == "list":
comp = sys.argv[2]
- list = 1
+ do_list = 1
else:
# Assume test mode.
runTest()
@@ -777,7 +777,7 @@ if __name__ == "__main__":
cfg = RHNOptions(comp)
cfg.parse()
- if list:
+ if do_list:
cfg.show()
else:
print cfg.get(key)
commit ffdbf5dd16d6f45468eed668c5637b8e42ef1367
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 22:19:21 2010 +0100
fixed W0612:318:CompressedCache.get: Unused variable 'e'
diff --git a/backend/common/rhnCache.py b/backend/common/rhnCache.py
index 9d3f212..73437c3 100644
--- a/backend/common/rhnCache.py
+++ b/backend/common/rhnCache.py
@@ -309,7 +309,7 @@ class CompressedCache:
fd = self.get_file(name, modified)
try:
value = fd.read()
- except (ValueError, IOError, gzip.zlib.error), e:
+ except (ValueError, IOError, gzip.zlib.error):
# Some gzip error
# poking at gzip.zlib may not be such a good idea
fd.close()
commit fa7621e3a3764edfb870985bb4ba701d7399694b
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 22:15:49 2010 +0100
fixed C0324:251:Cache.set: Comma not followed by a space def set(self, name, value, modified = None, user='root', group='root',\ ^^ mode=0755): fixed C0324:360:ObjectCache.set: Comma not followed by a space def set(self, name, value, modified = None, user='root', group='root',\ ^^ mode=0755):
diff --git a/backend/common/rhnCache.py b/backend/common/rhnCache.py
index a368f9e..9d3f212 100644
--- a/backend/common/rhnCache.py
+++ b/backend/common/rhnCache.py
@@ -246,7 +246,7 @@ class Cache:
return s
- def set(self, name, value, modified = None, user='root', group='root',\
+ def set(self, name, value, modified = None, user='root', group='root', \
mode=0755):
fd = self.set_file(name, modified, user, group, mode)
@@ -355,7 +355,7 @@ class ObjectCache:
except cPickle.UnpicklingError:
raise KeyError(name)
- def set(self, name, value, modified = None, user='root', group='root',\
+ def set(self, name, value, modified = None, user='root', group='root', \
mode=0755):
pickled = cPickle.dumps(value, -1)
self.cache.set(name, pickled, modified, user, group, mode)
commit f25063f4f1aeb18a204ca5b00662d44371353c8d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 22:14:33 2010 +0100
fixed W0232:239:Cache: Class has no __init__ method
diff --git a/backend/common/rhnCache.py b/backend/common/rhnCache.py
index 0c90a1a..a368f9e 100644
--- a/backend/common/rhnCache.py
+++ b/backend/common/rhnCache.py
@@ -235,6 +235,8 @@ class WriteLockedFile(LockedFile):
class Cache:
+ def __init__(self):
+ pass
def get(self, name, modified = None):
fd = self.get_file(name, modified)
commit 04dbbc462077bf1d7a4f9b2af70d1a76889c5aae
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 22:07:58 2010 +0100
fixed W0404: 29: Reimport 'fcntl' (imported line 22)
diff --git a/backend/common/rhnCache.py b/backend/common/rhnCache.py
index 385bf71..0c90a1a 100644
--- a/backend/common/rhnCache.py
+++ b/backend/common/rhnCache.py
@@ -26,7 +26,6 @@ from errno import EEXIST
from rhnLib import timestamp
import rhn_posix
-import fcntl
from spacewalk.common.fileutils import makedirs, setPermsPath
commit 3cf8506369848055cbfca78666d8231b972105ff
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 22:07:25 2010 +0100
fixed W0511:313: XXX poking at gzip.zlib may not be such a good idea
diff --git a/backend/common/rhnCache.py b/backend/common/rhnCache.py
index 3a90633..385bf71 100644
--- a/backend/common/rhnCache.py
+++ b/backend/common/rhnCache.py
@@ -310,7 +310,7 @@ class CompressedCache:
value = fd.read()
except (ValueError, IOError, gzip.zlib.error), e:
# Some gzip error
- # XXX poking at gzip.zlib may not be such a good idea
+ # poking at gzip.zlib may not be such a good idea
fd.close()
raise KeyError(name)
fd.close()
commit b78af5a608ab661dcb68f2d28d5426c012fe2ad0
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 22:01:46 2010 +0100
fixed W0201:219:rhnApache.setlang: Attribute 'domain' defined outside __init__
diff --git a/backend/common/rhnApache.py b/backend/common/rhnApache.py
index 4f2ec3a..ec23ad2 100644
--- a/backend/common/rhnApache.py
+++ b/backend/common/rhnApache.py
@@ -43,6 +43,7 @@ class rhnApache:
def __init__(self):
self.lang = "C"
+ self.domain = None
self.clientVersion = 0
self.proxyVersion = None
self.start_time = 0
commit 7a15cecd005ae8bc88fb0429c2163f464ea09e5d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 21:29:11 2010 +0100
fixed W0231:343:rhnException.__init__: __init__ method from base class 'Exception' is not called fixed W0141:344:rhnException.__init__: Used builtin function 'apply'
diff --git a/backend/common/rhnException.py b/backend/common/rhnException.py
index 19ab9ec..2976e0f 100644
--- a/backend/common/rhnException.py
+++ b/backend/common/rhnException.py
@@ -340,7 +340,7 @@ class rhnException(Exception):
"""
def __init__(self, *args):
- apply(Exception.__init__, (self, ) + args)
+ Exception.__init__(self, *args)
self.args = args
def __repr__(self):
commit 482798ca11713aa5d8591b3d81b3b4ed040d8ec9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 21:27:41 2010 +0100
fixed W0402: 17: Uses of a deprecated module 'string'
diff --git a/backend/common/rhnException.py b/backend/common/rhnException.py
index eadd5e2..19ab9ec 100644
--- a/backend/common/rhnException.py
+++ b/backend/common/rhnException.py
@@ -14,7 +14,6 @@
#
import sys
-import string
import xmlrpclib
@@ -427,12 +426,12 @@ class rhnFault(Exception):
s = StringIO()
s.write("\n")
if self.text:
- s.write(_("Error Message:\n %s\n") % string.strip(self.text))
+ s.write(_("Error Message:\n %s\n") % self.text.strip())
if self.code:
s.write(_("Error Class Code: %s\n") % self.code)
if self.arrayText:
- s.write(_("Error Class Info: %s\n") % \
- string.rstrip(self.arrayText % templateValues))
+ cinfo = self.arrayText % templateValues
+ s.write(_("Error Class Info: %s\n") % cinfo.rstrip())
if self.explain:
s.write(_("Explanation: %s") % Explain)
if not self.code:
commit bf87dac3e9f3a5226e8969610e4d01812e866938
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 21:18:20 2010 +0100
fixed W0622: 89:N_: Redefining built-in 'str'
diff --git a/backend/common/rhnTranslate.py b/backend/common/rhnTranslate.py
index 314f556..f93062f 100644
--- a/backend/common/rhnTranslate.py
+++ b/backend/common/rhnTranslate.py
@@ -85,8 +85,8 @@ class i18n:
self._set_catalog()
-def N_(str):
- return str
+def N_(msg):
+ return msg
cat = i18n()
_ = cat.gettext
commit f9d5b1e92ebee08d4b30bb8ca6faa161deba0c8d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 21:17:27 2010 +0100
fixed W0201: 57:i18n._set_catalog: Attribute 'cat' defined outside __init__
diff --git a/backend/common/rhnTranslate.py b/backend/common/rhnTranslate.py
index b0aaddb..314f556 100644
--- a/backend/common/rhnTranslate.py
+++ b/backend/common/rhnTranslate.py
@@ -50,6 +50,7 @@ class i18n:
self.domain = domain
self.localedir = localedir
self.langs = self._default_langs[:]
+ self.cat = None
self._set_catalog()
def _set_catalog(self):
commit 629c6a5c03a149616a2a2b9a8adad326f399ba17
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 21:16:09 2010 +0100
fixed C0321: 81:i18n.set: More than one statement on a single line
diff --git a/backend/common/rhnTranslate.py b/backend/common/rhnTranslate.py
index ad61158..b0aaddb 100644
--- a/backend/common/rhnTranslate.py
+++ b/backend/common/rhnTranslate.py
@@ -77,8 +77,10 @@ class i18n:
# reinitialize this catalog
def set(self, domain=None, localedir=None):
- if domain: self.domain = domain
- if localedir: self.localedir = localedir
+ if domain:
+ self.domain = domain
+ if localedir:
+ self.localedir = localedir
self._set_catalog()
commit 3d91e1153acdb7bdd1aac6a885c03c52d1bb09fc
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 21:11:32 2010 +0100
fixed W0201: 31:RHN_Translations._parse: Attribute 'lang' defined outside __init__
diff --git a/backend/common/rhnTranslate.py b/backend/common/rhnTranslate.py
index 0a9159a..ad61158 100644
--- a/backend/common/rhnTranslate.py
+++ b/backend/common/rhnTranslate.py
@@ -22,6 +22,10 @@ class RHN_Translations(gettext.GNUTranslations):
# Determining the language is not very pretty - we parse the file name
# which is supposed to be something like
# .../<lang>/LC_MESSAGES/<domain>.po
+ def __init__(self, fp=None):
+ self.lang = None
+ gettext.GNUTranslations.__init__(self, fp)
+
def _parse(self, fp):
gettext.GNUTranslations._parse(self, fp)
filename = fp.name
commit d12c130ab4a11cbdc8b1e663c9ef9c7f7af63b61
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 21:08:09 2010 +0100
fixed W0402: 19: Uses of a deprecated module 'string'
diff --git a/backend/common/rhnTranslate.py b/backend/common/rhnTranslate.py
index f89641b..0a9159a 100644
--- a/backend/common/rhnTranslate.py
+++ b/backend/common/rhnTranslate.py
@@ -16,7 +16,6 @@
import os
import types
import gettext
-import string
class RHN_Translations(gettext.GNUTranslations):
# Defining our own class, since we'd like to save the language we use
@@ -28,7 +27,7 @@ class RHN_Translations(gettext.GNUTranslations):
filename = fp.name
filename = os.path.normpath(filename)
# Extract the language
- self.lang = string.split(filename, '/')[-3]
+ self.lang = filename.split('/')[-3]
def getlangs(self):
# Return all languages
commit 5d7b91f82008e310f0a7a0894dc11c2bf956bd77
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 19:53:50 2010 +0100
fixed W0402: 21: Uses of a deprecated module 'string'
diff --git a/backend/common/rhnApache.py b/backend/common/rhnApache.py
index a60621f..4f2ec3a 100644
--- a/backend/common/rhnApache.py
+++ b/backend/common/rhnApache.py
@@ -18,7 +18,6 @@
# system module imports
import time
-import string
# global module imports
@@ -140,7 +139,7 @@ class rhnApache:
""" determine what language the client prefers """
if req.headers_in.has_key("Accept-Language"):
# RFC 2616 #3.10: case insensitive
- lang = string.lower(req.headers_in["Accept-Language"])
+ lang = req.headers_in["Accept-Language"].lower()
else:
lang = "C"
self.setlang(lang, self._lang_catalog)
@@ -226,7 +225,7 @@ class rhnApache:
And another lang function to produce the list of languages we're
handling
"""
- return string.join(cat.getlangs(), "; ")
+ return "; ".join(cat.getlangs())
def _setSessionToken(self, headers):
""" Pushes token into rhnFlags. If doesn't exist, returns None.
@@ -241,7 +240,7 @@ class rhnApache:
return None
prefix = "x-rhn-auth"
tokenKeys = filter(
- lambda x, prefix=prefix: string.lower(x[:len(prefix)]) == prefix,
+ lambda x, prefix=prefix: x[:len(prefix)].lower() == prefix,
headers.keys())
for k in tokenKeys:
token[k] = headers[k]
commit e61292c0123a0530d923b69045b891ff49acf4ca
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 19:43:46 2010 +0100
fixed C0322: 44: Operator not preceded by a space HTTP_PROXY_AUTHENTICATION_REQUIRED= 407
diff --git a/backend/common/apache.py b/backend/common/apache.py
index 032eb17..7fd6d22 100644
--- a/backend/common/apache.py
+++ b/backend/common/apache.py
@@ -41,7 +41,7 @@ HTTP_FORBIDDEN = 403
HTTP_NOT_FOUND = 404
HTTP_METHOD_NOT_ALLOWED = 405
HTTP_NOT_ACCEPTABLE = 406
-HTTP_PROXY_AUTHENTICATION_REQUIRED= 407
+HTTP_PROXY_AUTHENTICATION_REQUIRED = 407
HTTP_REQUEST_TIME_OUT = 408
HTTP_CONFLICT = 409
HTTP_GONE = 410
commit 1ff6dd2e465f3f4d9f150a1044f8091c545ce673
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 19:36:09 2010 +0100
fixed W0622: 71:UserDictCase.update: Redefining built-in 'dict'
diff --git a/backend/common/UserDictCase.py b/backend/common/UserDictCase.py
index 2c2624c..ddd1ee3 100644
--- a/backend/common/UserDictCase.py
+++ b/backend/common/UserDictCase.py
@@ -66,8 +66,8 @@ class UserDictCase(UserDict):
# get a dictionary out of this instance ({}.update doesn't get instances)
def dict(self):
return self.get_hash()
- def update(self, dict):
- for (k, v) in dict.items():
+ def update(self, updict):
+ for (k, v) in updict.items():
lk = k
if isinstance(k, StringType):
lk = k.lower()
commit 8427d48e25feaf4eeb2d300bf34e8a15b5839c63
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 28 19:33:51 2010 +0100
fixed W0402: 17: Uses of a deprecated module 'string'
diff --git a/backend/common/UserDictCase.py b/backend/common/UserDictCase.py
index 962ba50..2c2624c 100644
--- a/backend/common/UserDictCase.py
+++ b/backend/common/UserDictCase.py
@@ -14,8 +14,6 @@
#
#
-import string
-
from types import StringType
from UserDict import UserDict
@@ -28,18 +26,18 @@ class UserDictCase(UserDict):
def __setitem__(self, key, value):
lkey = key
if isinstance(key, StringType):
- lkey = string.lower(key)
+ lkey = key.lower()
self.data[lkey] = value
self.kcase[lkey] = key
def __getitem__(self, key):
if isinstance(key, StringType):
- key = string.lower(key)
+ key = key.lower()
if not self.data.has_key(key):
return None
return self.data[key]
def __delitem__(self, key):
if isinstance(key, StringType):
- key = string.lower(key)
+ key = key.lower()
del self.data[key]
del self.kcase[key]
get = __getitem__
@@ -49,7 +47,7 @@ class UserDictCase(UserDict):
return self.get_hash().items()
def has_key(self, key):
if isinstance(key, StringType):
- key = string.lower(key)
+ key = key.lower()
return self.data.has_key(key)
def clear(self):
self.data.clear()
@@ -72,7 +70,7 @@ class UserDictCase(UserDict):
for (k, v) in dict.items():
lk = k
if isinstance(k, StringType):
- lk = string.lower(k)
+ lk = k.lower()
self.data[lk] = v
self.kcase[lk] = k
# Expose an iterator. This would normally fail if there is no iter()
12 years, 9 months
backend/server
by Šimon Lukašík
backend/server/rhnLib.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit c3f55db240cda34bc1ef4fa58a257ed361151391
Author: Simon Lukasik <slukasik(a)redhat.com>
Date: Thu Dec 30 19:54:16 2010 +0100
Allow clients to retrieve debian packages
Well, the function named parseRPMFilename is probably supposed to parse
an rpm package name. But considering the fact, that debian packages stored
in /var/satellite already have rpm-like naming scheme, the single function
will do the job.
diff --git a/backend/server/rhnLib.py b/backend/server/rhnLib.py
index a5f6584..d83407c 100644
--- a/backend/server/rhnLib.py
+++ b/backend/server/rhnLib.py
@@ -75,8 +75,8 @@ def parseRPMFilename(pkgFilename):
pkg = string.split(pkgFilename, '.')
# 'rpm' at end?
- if string.lower(pkg[-1]) != 'rpm':
- raise rhnFault(21, 'not an rpm package name: %s' % pkgFilename)
+ if string.lower(pkg[-1]) not in ['rpm', 'deb']:
+ raise rhnFault(21, 'neither an rpm nor a deb package name: %s' % pkgFilename)
# Valid architecture next?
if check_package_arch(pkg[-2]) is None:
12 years, 9 months
Changes to 'refs/tags/spacewalk-selinux-1.3.1-1'
by Jan Pazdziora
Tag 'spacewalk-selinux-1.3.1-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2010-12-29 20:00 +0000
Tagging package [spacewalk-selinux] version [1.3.1-1] in directory [selinux/spacewalk-selinux/].
Changes since spacewalk-setup-1.3.4-1:
Jan Pazdziora (2):
Create sqlplus spool files with different type than the directories, to allow write.
Automatic commit of package [spacewalk-selinux] release [1.3.1-1].
---
rel-eng/packages/spacewalk-selinux | 2 +-
selinux/spacewalk-selinux/spacewalk-selinux.spec | 6 +++++-
selinux/spacewalk-selinux/spacewalk.te | 9 ++++++---
3 files changed, 12 insertions(+), 5 deletions(-)
---
12 years, 9 months
rel-eng/packages selinux/spacewalk-selinux
by Jan Pazdziora
rel-eng/packages/spacewalk-selinux | 2 +-
selinux/spacewalk-selinux/spacewalk-selinux.spec | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit 9ac1838d2834e555760cc23f7e3c05810872c8d2
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Dec 29 21:00:00 2010 +0100
Automatic commit of package [spacewalk-selinux] release [1.3.1-1].
diff --git a/rel-eng/packages/spacewalk-selinux b/rel-eng/packages/spacewalk-selinux
index 8754b0c..8abd265 100644
--- a/rel-eng/packages/spacewalk-selinux
+++ b/rel-eng/packages/spacewalk-selinux
@@ -1 +1 @@
-1.2.5-1 selinux/spacewalk-selinux/
+1.3.1-1 selinux/spacewalk-selinux/
diff --git a/selinux/spacewalk-selinux/spacewalk-selinux.spec b/selinux/spacewalk-selinux/spacewalk-selinux.spec
index fe21625..2087071 100644
--- a/selinux/spacewalk-selinux/spacewalk-selinux.spec
+++ b/selinux/spacewalk-selinux/spacewalk-selinux.spec
@@ -7,7 +7,7 @@
%define modulename spacewalk
Name: spacewalk-selinux
-Version: 1.3.0
+Version: 1.3.1
Release: 1%{?dist}
Summary: SELinux policy module supporting Spacewalk Server
@@ -113,6 +113,10 @@ fi
%attr(0755,root,root) %{_sbindir}/%{name}-enable
%changelog
+* Wed Dec 29 2010 Jan Pazdziora 1.3.1-1
+- Create sqlplus spool files with different type than the directories, to allow
+ write.
+
* Fri Nov 05 2010 Miroslav Suchý <msuchy(a)redhat.com> 1.2.5-1
- set correct context on satidmap.pl (msuchy(a)redhat.com)
12 years, 9 months
selinux/spacewalk-selinux
by Jan Pazdziora
selinux/spacewalk-selinux/spacewalk.te | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
New commits:
commit a5e6c7e0b47215263ed2ab471d21b4e2c958bce7
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Dec 29 18:32:28 2010 +0100
Create sqlplus spool files with different type than the directories, to allow write.
Addressing
avc: denied { write } for pid=2078 comm="sqlplus" name="20101229-115741-begin.log" dev=dm-0 ino=1842632 scontext=unconfined_u:unconfined_r:oracle_sqlplus_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:spacewalk_db_install_log_t:s0 tclass=file
Sadly, sqlplus does not use O_APPEND even if spool filename append
is used. So we have to allow the write but we do not want sqlplus
to overwrite all other logs.
And on Fedora 13, append_files_pattern no longer gives plain write.
diff --git a/selinux/spacewalk-selinux/spacewalk.te b/selinux/spacewalk-selinux/spacewalk.te
index bc40b45..5ef5605 100644
--- a/selinux/spacewalk-selinux/spacewalk.te
+++ b/selinux/spacewalk-selinux/spacewalk.te
@@ -64,14 +64,17 @@ tunable_policy(`spacewalk_nfs_mountpoint',`
')
type spacewalk_db_install_log_t;
-logging_log_file(spacewalk_db_install_log_t);
+files_type(spacewalk_db_install_log_t);
optional_policy(`
+ type spacewalk_sqlplus_spool_log_t;
+ logging_log_file(spacewalk_sqlplus_spool_log_t);
gen_require(`
type oracle_port_t;
type oracle_sqlplus_t;
')
allow httpd_t oracle_port_t:tcp_socket name_connect;
- append_files_pattern(oracle_sqlplus_t, spacewalk_db_install_log_t, spacewalk_db_install_log_t);
+ rw_files_pattern(oracle_sqlplus_t, spacewalk_db_install_log_t, spacewalk_sqlplus_spool_log_t);
read_files_pattern(oracle_sqlplus_t, spacewalk_db_install_log_t, spacewalk_db_install_log_t);
- create_files_pattern(oracle_sqlplus_t, spacewalk_db_install_log_t, spacewalk_db_install_log_t);
+ create_files_pattern(oracle_sqlplus_t, spacewalk_db_install_log_t, spacewalk_sqlplus_spool_log_t);
+ filetrans_pattern(oracle_sqlplus_t, spacewalk_db_install_log_t, spacewalk_sqlplus_spool_log_t, file)
')
12 years, 9 months
Changes to 'refs/tags/spacewalk-setup-1.3.4-1'
by Jan Pazdziora
Tag 'spacewalk-setup-1.3.4-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2010-12-26 22:27 +0000
Tagging package [spacewalk-setup] version [1.3.4-1] in directory [spacewalk/setup/].
Changes since spacewalk-backend-1.3.35-1:
Jan Pazdziora (1):
Automatic commit of package [spacewalk-setup] release [1.3.4-1].
---
rel-eng/packages/spacewalk-setup | 2 +-
spacewalk/setup/spacewalk-setup.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
---
12 years, 9 months
rel-eng/packages spacewalk/setup
by Jan Pazdziora
rel-eng/packages/spacewalk-setup | 2 +-
spacewalk/setup/spacewalk-setup.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 210370ab84a94c156f0239841bb363626f02a143
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Sun Dec 26 23:27:52 2010 +0100
Automatic commit of package [spacewalk-setup] release [1.3.4-1].
diff --git a/rel-eng/packages/spacewalk-setup b/rel-eng/packages/spacewalk-setup
index 2fcb832..bd1f42a 100644
--- a/rel-eng/packages/spacewalk-setup
+++ b/rel-eng/packages/spacewalk-setup
@@ -1 +1 @@
-1.3.3-1 spacewalk/setup/
+1.3.4-1 spacewalk/setup/
diff --git a/spacewalk/setup/spacewalk-setup.spec b/spacewalk/setup/spacewalk-setup.spec
index 2d11496..f703350 100644
--- a/spacewalk/setup/spacewalk-setup.spec
+++ b/spacewalk/setup/spacewalk-setup.spec
@@ -1,5 +1,5 @@
Name: spacewalk-setup
-Version: 1.3.3
+Version: 1.3.4
Release: 1%{?dist}
Summary: Initial setup tools for Red Hat Spacewalk
@@ -101,6 +101,9 @@ rm -rf %{buildroot}
%attr(755, apache, root) %{_var}/spacewalk
%changelog
+* Sun Dec 26 2010 Jan Pazdziora 1.3.4-1
+- 665693: convert sysdate to current_timestamp (colin.coe(a)gmail.com)
+
* Thu Dec 23 2010 Jan Pazdziora 1.3.3-1
- The rhn_package package (schema in PostgreSQL) is now gone.
12 years, 9 months