backend/common/rhnApache.py | 1
backend/common/rhnCache.py | 1
backend/common/rhnLib.py | 2
backend/common/rhnLog.py | 1
backend/satellite_exporter/handlers/non_auth_dumper.py | 5
backend/satellite_tools/connection.py | 1
backend/satellite_tools/diskImportLib.py | 4
backend/satellite_tools/disk_dumper/dumper.py | 4
backend/satellite_tools/disk_dumper/iss.py | 2
backend/satellite_tools/repo_plugins/yum_src.py | 1
backend/satellite_tools/reposync.py | 7
backend/satellite_tools/satsync.py | 156 ++++------
backend/satellite_tools/syncCache.py | 2
backend/satellite_tools/syncLib.py | 2
backend/satellite_tools/updatePackages.py | 3
backend/satellite_tools/xmlDiskSource.py | 1
backend/server/action/rollback.py | 1
backend/server/apacheServer.py | 5
backend/server/apacheUploadServer.py | 2
backend/server/basePackageUpload.py | 2
backend/server/handlers/app/test/test_channel.py | 1
backend/server/handlers/sat/auth.py | 2
backend/server/handlers/xmlrpc/registration.py | 5
backend/server/importlib/backend.py | 2
backend/server/importlib/debPackage.py | 6
utils/spacewalk-common-channels | 99 +++---
utils/spacewalk-common-channels.ini | 73 ++++
web/modules/rhn/RHN/DB/ContactMethod.pm | 2
web/modules/rhn/RHN/DB/DataSource/xml/contact_method_queries.xml | 6
29 files changed, 215 insertions(+), 184 deletions(-)
New commits:
commit 71b60f92e7d6b9c1895bab1906e1fbc3768cecf9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 23 16:54:17 2010 +0100
removed unused imports
diff --git a/backend/common/rhnApache.py b/backend/common/rhnApache.py
index c91dcaa..f7a4e4d 100644
--- a/backend/common/rhnApache.py
+++ b/backend/common/rhnApache.py
@@ -19,7 +19,6 @@
# system module imports
import time
import string
-import os.path
# global module imports
diff --git a/backend/common/rhnCache.py b/backend/common/rhnCache.py
index c09865c..3a90633 100644
--- a/backend/common/rhnCache.py
+++ b/backend/common/rhnCache.py
@@ -19,7 +19,6 @@
import os
import gzip
import cPickle
-import cStringIO
import fcntl
from struct import pack
from stat import ST_MTIME
diff --git a/backend/common/rhnLib.py b/backend/common/rhnLib.py
index 05d184f..df5b038 100644
--- a/backend/common/rhnLib.py
+++ b/backend/common/rhnLib.py
@@ -17,8 +17,6 @@ import time
import types
import string
import urlparse
-from spacewalk.common.rhnLog import log_debug, log_error
-from spacewalk.common.checksum import getFileChecksum
def setHeaderValue(mp_table, name, values):
"""
diff --git a/backend/common/rhnLog.py b/backend/common/rhnLog.py
index b94d935..462f5e0 100644
--- a/backend/common/rhnLog.py
+++ b/backend/common/rhnLog.py
@@ -32,7 +32,6 @@
# system module imports
import os
import sys
-import pwd
import string
import traceback
import time
diff --git a/backend/satellite_exporter/handlers/non_auth_dumper.py
b/backend/satellite_exporter/handlers/non_auth_dumper.py
index f830267..7187a17 100644
--- a/backend/satellite_exporter/handlers/non_auth_dumper.py
+++ b/backend/satellite_exporter/handlers/non_auth_dumper.py
@@ -18,9 +18,8 @@ Non-authenticated dumper
import os
import xmlrpclib
-import gzip, tempfile
-from spacewalk.common import log_debug, log_error, rhnFault, CFG, UserDictCase, rhnCache
-from spacewalk.common import rhnLib as rhnLib_common
+import gzip
+from spacewalk.common import log_debug, log_error, rhnFault, CFG, UserDictCase
from spacewalk.server import rhnSQL, rhnLib
from spacewalk.server.rhnHandler import rhnHandler
from spacewalk.server.importlib.backendLib import localtime
diff --git a/backend/satellite_tools/connection.py
b/backend/satellite_tools/connection.py
index e7c7fc3..9be0a64 100644
--- a/backend/satellite_tools/connection.py
+++ b/backend/satellite_tools/connection.py
@@ -16,7 +16,6 @@
#
#
-import string
import gzipstream
from rhn import rpclib
diff --git a/backend/satellite_tools/diskImportLib.py
b/backend/satellite_tools/diskImportLib.py
index 0a4ea97..0462c7b 100644
--- a/backend/satellite_tools/diskImportLib.py
+++ b/backend/satellite_tools/diskImportLib.py
@@ -18,9 +18,7 @@
import os
-from xml.sax import SAXParseException
-
-from spacewalk.common import Traceback, CFG
+from spacewalk.common import CFG
from spacewalk.common.rhnLib import hash_object_id
from spacewalk.server.rhnSQL.const import ORACLE, POSTGRESQL
diff --git a/backend/satellite_tools/disk_dumper/dumper.py
b/backend/satellite_tools/disk_dumper/dumper.py
index f58a8c2..89ed8b0 100644
--- a/backend/satellite_tools/disk_dumper/dumper.py
+++ b/backend/satellite_tools/disk_dumper/dumper.py
@@ -15,13 +15,11 @@
import time
import gzip
-import string
import tempfile
-import re
from types import ListType
from cStringIO import StringIO
-from spacewalk.common import log_debug, log_error, rhnFault, UserDictCase, rhnCache, \
+from spacewalk.common import log_debug, log_error, rhnFault, rhnCache, \
CFG, rhnLib, rhnFlags
from spacewalk.server import rhnSQL, rhnDatabaseCache
from spacewalk.satellite_tools import constants
diff --git a/backend/satellite_tools/disk_dumper/iss.py
b/backend/satellite_tools/disk_dumper/iss.py
index aa09bfa..7557a5f 100644
--- a/backend/satellite_tools/disk_dumper/iss.py
+++ b/backend/satellite_tools/disk_dumper/iss.py
@@ -25,7 +25,7 @@ from spacewalk.server import rhnSQL
from spacewalk.server.rhnSQL import SQLError, SQLSchemaError, SQLConnectError
from spacewalk.satellite_tools.exporter import xmlWriter
from spacewalk.satellite_tools import xmlDiskSource, diskImportLib, progress_bar
-from spacewalk.satellite_tools.syncLib import initEMAIL_LOG, dumpEMAIL_LOG, log2email,
log2stderr, log2stdout, log
+from spacewalk.satellite_tools.syncLib import initEMAIL_LOG, dumpEMAIL_LOG, log2email,
log2stderr, log2stdout
from iss_ui import UI
from iss_actions import ActionDeps
import shutil
diff --git a/backend/satellite_tools/repo_plugins/yum_src.py
b/backend/satellite_tools/repo_plugins/yum_src.py
index 276296c..12f44a7 100644
--- a/backend/satellite_tools/repo_plugins/yum_src.py
+++ b/backend/satellite_tools/repo_plugins/yum_src.py
@@ -15,7 +15,6 @@
import yum
import shutil
import sys
-from yum import config
from spacewalk.satellite_tools.reposync import ContentPackage
class YumWarnings:
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index d9826e3..9ef4319 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -12,13 +12,12 @@
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#
-import sys, os, time, grp
+import sys, os, time
import hashlib
from optparse import OptionParser
from spacewalk.server import rhnPackage, rhnSQL, rhnChannel, rhnPackageUpload
-from spacewalk.common import CFG, initCFG, rhnLog, fetchTraceback, rhn_rpm
+from spacewalk.common import CFG, initCFG, rhnLog
from spacewalk.common.checksum import getFileChecksum
-from spacewalk.common.rhn_mpm import InvalidPackageError
from spacewalk.server.importlib.importLib import IncompletePackage
from spacewalk.server.importlib.packageImport import ChannelPackageSubscription
from spacewalk.server import taskomatic
diff --git a/backend/satellite_tools/syncCache.py b/backend/satellite_tools/syncCache.py
index 7500e89..be578ff 100644
--- a/backend/satellite_tools/syncCache.py
+++ b/backend/satellite_tools/syncCache.py
@@ -18,8 +18,6 @@
# system imports:
import os
-import math
-import string
# rhn imports:
from spacewalk.common import CFG, rhnCache
diff --git a/backend/satellite_tools/syncLib.py b/backend/satellite_tools/syncLib.py
index 8e3f2ee..356a1b8 100644
--- a/backend/satellite_tools/syncLib.py
+++ b/backend/satellite_tools/syncLib.py
@@ -16,8 +16,6 @@
# system imports:
import os
import sys
-import grp
-import pwd
import time
from cStringIO import StringIO
diff --git a/backend/satellite_tools/updatePackages.py
b/backend/satellite_tools/updatePackages.py
index 3bbb9fc..14bedbf 100644
--- a/backend/satellite_tools/updatePackages.py
+++ b/backend/satellite_tools/updatePackages.py
@@ -18,11 +18,10 @@
import sys
import os
-import time
import shutil
from optparse import Option, OptionParser
-from spacewalk.common import rhnLib, rhnLog, initLOG, CFG, initCFG
+from spacewalk.common import rhnLog, initLOG, CFG, initCFG
from spacewalk.common import rhn_rpm
from spacewalk.server.rhnLib import parseRPMFilename, get_package_path
from spacewalk.server import rhnSQL, rhnPackageUpload
diff --git a/backend/satellite_tools/xmlDiskSource.py
b/backend/satellite_tools/xmlDiskSource.py
index 50b7cfa..8a2ea5a 100644
--- a/backend/satellite_tools/xmlDiskSource.py
+++ b/backend/satellite_tools/xmlDiskSource.py
@@ -17,7 +17,6 @@
import os
import gzip
-import string
from spacewalk.common.fileutils import createPath
from spacewalk.common.rhnLib import hash_object_id
diff --git a/backend/server/action/rollback.py b/backend/server/action/rollback.py
index d7e7e4d..048a8e3 100644
--- a/backend/server/action/rollback.py
+++ b/backend/server/action/rollback.py
@@ -17,7 +17,6 @@
#
from spacewalk.common import log_debug, log_error
-from spacewalk.server import rhnSQL
from spacewalk.server.rhnLib import InvalidAction
# the "exposed" functions
diff --git a/backend/server/apacheServer.py b/backend/server/apacheServer.py
index 1898e84..ad86c03 100644
--- a/backend/server/apacheServer.py
+++ b/backend/server/apacheServer.py
@@ -14,11 +14,6 @@
#
# global module imports
-from spacewalk.common import apache
-
-# common module imports
-from spacewalk.common import CFG, initCFG, log_setreq, initLOG, Traceback
-
from apacheHandler import apacheHandler
apache_server = apacheHandler()
HeaderParserHandler = apache_server.headerParserHandler
diff --git a/backend/server/apacheUploadServer.py b/backend/server/apacheUploadServer.py
index 3f4d344..95f2409 100644
--- a/backend/server/apacheUploadServer.py
+++ b/backend/server/apacheUploadServer.py
@@ -21,7 +21,7 @@ import rhnSession
from spacewalk.common import CFG, initCFG, log_debug, log_error, log_setreq, initLOG, \
Traceback, rhnFault, rhnFlags
-from spacewalk.server import apacheServer, rhnImport
+from spacewalk.server import rhnImport
class UploadHandler:
def __init__(self):
diff --git a/backend/server/basePackageUpload.py b/backend/server/basePackageUpload.py
index e611233..6796fa9 100644
--- a/backend/server/basePackageUpload.py
+++ b/backend/server/basePackageUpload.py
@@ -14,8 +14,6 @@
#
# $Id$
-import os
-import tempfile
from spacewalk.common import apache
from spacewalk.common import log_debug, rhnFault, UserDictCase
diff --git a/backend/server/handlers/app/test/test_channel.py
b/backend/server/handlers/app/test/test_channel.py
index 32dd508..55acb6a 100644
--- a/backend/server/handlers/app/test/test_channel.py
+++ b/backend/server/handlers/app/test/test_channel.py
@@ -14,7 +14,6 @@
# in this software or its documentation.
#
-import sys
import unittest
from spacewalk.server import rhnSQL
from spacewalk.common import rhnFault
diff --git a/backend/server/handlers/sat/auth.py b/backend/server/handlers/sat/auth.py
index fae14d0..aa6d689 100644
--- a/backend/server/handlers/sat/auth.py
+++ b/backend/server/handlers/sat/auth.py
@@ -19,7 +19,7 @@ import time
from spacewalk.common import CFG, rhnFault, log_debug
from spacewalk.common.rhnTranslate import _
from spacewalk.server.rhnHandler import rhnHandler
-from spacewalk.server import rhnSQL, rhnLib
+from spacewalk.server import rhnLib
class Authentication(rhnHandler):
""" Simple authentication based on hostname and allowed_iss_slaves
diff --git a/backend/server/handlers/xmlrpc/registration.py
b/backend/server/handlers/xmlrpc/registration.py
index f75fb26..336036e 100644
--- a/backend/server/handlers/xmlrpc/registration.py
+++ b/backend/server/handlers/xmlrpc/registration.py
@@ -14,7 +14,6 @@
#
# system modules
-import types
import string
from spacewalk.common import CFG, rhnFault, rhnFlags, log_debug, log_error, rhnMail
@@ -25,9 +24,7 @@ from spacewalk.server.rhnServer import server_route, server_lib
from spacewalk.server.rhnMapping import real_version
from spacewalk.server.rhnHandler import rhnHandler
from spacewalk.server import rhnUser, rhnServer, rhnSQL, rhnCapability, \
- rhnChannel, rhnAction, rhnVirtualization
-from spacewalk.server.rhnSQL import procedure
-from spacewalk.server.action.utils import ChannelPackage
+ rhnChannel, rhnVirtualization
def hash_validate(data, *keylist):
diff --git a/backend/server/importlib/backend.py b/backend/server/importlib/backend.py
index b613bed..cd91c2e 100644
--- a/backend/server/importlib/backend.py
+++ b/backend/server/importlib/backend.py
@@ -18,8 +18,6 @@
import copy
import string
-import re
-import sys
from spacewalk.common import rhnFault, CFG, rhn_rpm
from spacewalk.server import rhnSQL, rhnChannel, taskomatic
diff --git a/backend/server/importlib/debPackage.py
b/backend/server/importlib/debPackage.py
index 8b050ec..9201ce2 100644
--- a/backend/server/importlib/debPackage.py
+++ b/backend/server/importlib/debPackage.py
@@ -17,13 +17,11 @@
#
import headerSource
-import os
import time
import string
-from importLib import File, Dependency, ChangeLog, Channel, \
- IncompletePackage, Package, SourcePackage
+from importLib import Channel
from backendLib import gmtime, localtime
-from types import ListType, TupleType, IntType
+from types import IntType
class debBinaryPackage(headerSource.rpmBinaryPackage):
commit 5989d83776c9cc1402c27a866fc33885dc85435c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 23 16:26:32 2010 +0100
removed unused import
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index 6ddb21e..2356c3f 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -25,7 +25,6 @@ import string
import time
import types
import exceptions
-import cStringIO
import locale
from optparse import Option, OptionParser
commit cbbaefd27690b33a5c7673dfc1fd6a3e0e5a828c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 23 16:20:07 2010 +0100
fixed indentation according to pylint
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index 0722de5..6ddb21e 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -699,21 +699,21 @@ Please contact your RHN representative""") %
(generation, sat_cert.generation))
if 'export-type' not in channel or channel['export-type'] is
None:
return ''
else:
- export_type = channel['export-type']
+ export_type = channel['export-type']
if 'export-start-date' in channel and
channel['export-start-date'] is not None:
- start_date = channel['export-start-date']
+ start_date = channel['export-start-date']
else:
- start_date = ''
+ start_date = ''
if 'export-end-date' in channel and channel['export-end-date'] is
not None:
- end_date = channel['export-end-date']
+ end_date = channel['export-end-date']
else:
- end_date = ''
+ end_date = ''
if end_date and not start_date:
- return _("%10s import from %s") % (export_type,
self._formatDateTime(end_date))
+ return _("%10s import from %s") % (export_type,
self._formatDateTime(end_date))
elif end_date and start_date:
- return _("%10s import from %s - %s") % (export_type,
self._formatDateTime(start_date), self._formatDateTime(end_date))
+ return _("%10s import from %s - %s") % (export_type,
self._formatDateTime(start_date), self._formatDateTime(end_date))
else:
- return _("%10s") % export_type
+ return _("%10s") % export_type
def _printChannel(self, label, channel_object, format, is_imported):
assert channel_object is not None
@@ -906,28 +906,28 @@ Please contact your RHN representative""") %
(generation, sat_cert.generation))
h = rhnSQL.prepare(self._query_compare_packages)
for pid in chunk:
- p_timestamp = package_collection.get_package_timestamp(pid)
- l_timestamp = rhnLib.timestamp(p_timestamp)
- package = package_collection.get_package(pid, p_timestamp)
- assert package is not None
-
- if package['org_id'] is not None:
- package['org_id'] = OPTIONS.orgid or DEFAULT_ORG
- nevra = get_nevra_dict(package)
- nevra['org_id'] = package['org_id']
-
- h.execute(**nevra)
- row = None
- for r in (h.fetchall_dict() or []):
- # let's check which checksum we have in database
- if package['checksums'][r['checksum_type']] ==
r['checksum']:
- row = r
- break
+ p_timestamp = package_collection.get_package_timestamp(pid)
+ l_timestamp = rhnLib.timestamp(p_timestamp)
+ package = package_collection.get_package(pid, p_timestamp)
+ assert package is not None
+
+ if package['org_id'] is not None:
+ package['org_id'] = OPTIONS.orgid or DEFAULT_ORG
+ nevra = get_nevra_dict(package)
+ nevra['org_id'] = package['org_id']
+
+ h.execute(**nevra)
+ row = None
+ for r in (h.fetchall_dict() or []):
+ # let's check which checksum we have in database
+ if package['checksums'][r['checksum_type']] ==
r['checksum']:
+ row = r
+ break
- self._process_package(pid, package, l_timestamp, row,
- self._missing_channel_packages[channel_label],
- self._missing_fs_packages[channel_label],
- source=0, check_rpms=self.check_rpms)
+ self._process_package(pid, package, l_timestamp, row,
+ self._missing_channel_packages[channel_label],
+ self._missing_fs_packages[channel_label],
+ source=0, check_rpms=self.check_rpms)
# XXX the "is null" condition will have to change in multiorg satellites
def _diff_packages(self):
@@ -953,10 +953,10 @@ Please contact your RHN representative""") %
(generation, sat_cert.generation))
not available in the current dump, probably because of applying an
incremental to the wrong base"""
for channel_label, pids in missing_channel_packages.items():
- if sources:
- avail_pids = map(lambda x: x[0], self._avail_channel_source_packages[channel_label])
- else:
- avail_pids = self._avail_channel_packages[channel_label]
+ if sources:
+ avail_pids = map(lambda x: x[0],
self._avail_channel_source_packages[channel_label])
+ else:
+ avail_pids = self._avail_channel_packages[channel_label]
if set(pids or []) > set(avail_pids or []):
raise RhnSyncException, _('ERROR: incremental dump skipped')
@@ -1017,10 +1017,10 @@ Please contact your RHN representative""") %
(generation, sat_cert.generation))
db_path = row['path']
if not (l_timestamp <= db_timestamp and
- checksum == db_checksum and
- package_size == db_package_size):
- # package doesn't match
- channel_package = package_id
+ checksum == db_checksum and
+ package_size == db_package_size):
+ # package doesn't match
+ channel_package = package_id
if check_rpms:
if db_path:
@@ -1190,25 +1190,25 @@ Please contact your RHN representative""") %
(generation, sat_cert.generation))
sql_params = ['package_id', 'checksum', 'checksum_type']
h = rhnSQL.prepare(self._query_compare_source_packages)
for pid, timestamp in chunk:
- package = package_collection.get_package(pid, timestamp)
- assert package is not None
+ package = package_collection.get_package(pid, timestamp)
+ assert package is not None
- params = {}
- for t in sql_params:
- params[t] = package[t] or ""
+ params = {}
+ for t in sql_params:
+ params[t] = package[t] or ""
- if package['org_id'] is not None:
- params['org_id'] = OPTIONS.orgid or DEFAULT_ORG
- package['org_id'] = OPTIONS.orgid or DEFAULT_ORG
- else:
- params['org_id'] = package['org_id']
+ if package['org_id'] is not None:
+ params['org_id'] = OPTIONS.orgid or DEFAULT_ORG
+ package['org_id'] = OPTIONS.orgid or DEFAULT_ORG
+ else:
+ params['org_id'] = package['org_id']
- apply(h.execute, (), params)
- row = h.fetchone_dict()
- self._process_package(pid, package, None, row,
- self._missing_channel_source_packages[channel_label],
- self._missing_fs_source_packages[channel_label],
- source=1)
+ apply(h.execute, (), params)
+ row = h.fetchone_dict()
+ self._process_package(pid, package, None, row,
+ self._missing_channel_source_packages[channel_label],
+ self._missing_fs_source_packages[channel_label],
+ source=1)
# XXX the "is null" condition will have to change in multiorg satellites
def _diff_source_packages(self):
@@ -1617,15 +1617,13 @@ Please contact your RHN representative""") %
(generation, sat_cert.generation))
pkgd['checksum_type'],
pkgd['checksum'])
def _lookup_pkgs_by_path(self, path):
- h = rhnSQL.prepare("""select P.id, P.path, CV.checksum,
CV.checksum_type
+ h = rhnSQL.prepare("""select P.id, P.path, CV.checksum,
CV.checksum_type
from rhnPackage P left join
rhnPackageKeyAssociation PA on PA.package_id = P.id
inner join
rhnChecksumView CV on CV.id = P.checksum_id
where p.path = :path and PA.key_id is
null""")
- h.execute(path=path)
- return h.fetchall_dict()
-
-
+ h.execute(path=path)
+ return h.fetchall_dict()
def _link_channel_packages(self):
log(1, ["", messages.link_channel_packages])
@@ -1896,7 +1894,7 @@ class StreamProducer:
self._args = args
def close(self):
- self.handler.close()
+ self.handler.close()
def process(self, batch):
if self.is_disk_loader:
commit 38447be39620b862e7a8b8dff813d089df8fbdda
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 23 16:10:52 2010 +0100
remove unused variable
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index 8027d84..0722de5 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -1262,18 +1262,11 @@ Please contact your RHN representative""") %
(generation, sat_cert.generation))
- already_seen_kickstarts)
already_seen_kickstarts.update(self._channel_kickstarts[chn])
- _query_get_kickstarts = rhnSQL.Statement("""
- select TO_CHAR(last_modified, 'YYYYMMDDHH24MISS') last_modified
- from rhnKickstartableTree
- where label = :label
- """)
-
def _compute_missing_kickstarts(self):
""" process package metadata for one channel at a
time"""
relevant = self._channel_req.get_requested_channels()
coll = sync_handlers.KickstartableTreesCollection()
missing_kickstarts = {}
- h = rhnSQL.Statement(self._query_get_kickstarts)
for chn in relevant:
timestamp = self._get_channel_timestamp(chn)
commit b85c99b3c22f9bc2b37c0654322f319e60395ccd
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 23 15:56:16 2010 +0100
remove unreachable code
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index f9398cf..8027d84 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -1290,22 +1290,6 @@ Please contact your RHN representative""") %
(generation, sat_cert.generation))
# Once we add it, we should be able to do more meaningful
# diffs
missing_kickstarts[kt_label] = None
- continue
-
- timestamp = int(rhnLib.timestamp(kt['last_modified']))
-
- h.execute(label=kt_label)
- row = h.fetchone_dict()
- if not row:
- # Missing
- missing_kickstarts[kt_label] = timestamp
- continue
-
- db_timestamp = int(rhnLib.timestamp(row['last_modified']))
- if timestamp != db_timestamp:
- # Different timestamp
- missing_kickstarts[kt_label] = timestamp
- continue
ret = missing_kickstarts.items()
ret.sort()
commit 703340b8b72ca2a5884906ab22d483e95caabc67
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 23 15:51:09 2010 +0100
fixed pylint warnings
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index 9a84a18..f9398cf 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -314,7 +314,7 @@ class Runner:
try:
return self.syncer.processShortPackages()
except xmlDiskSource.MissingXmlDiskSourceFileError, e:
- msg= _("ERROR: The dump is missing package data, use --no-rpms to skip
this step or fix the content to include package data.")
+ msg = _("ERROR: The dump is missing package data, use --no-rpms to skip
this step or fix the content to include package data.")
log2disk(-1, msg)
log2stderr(-1, msg, cleanYN=1)
sys.exit(25)
@@ -540,7 +540,7 @@ class Syncer:
cert = row['cert']
return self._process_cert(cert, store_cert=0)
else:
- log2(1, 3, ["",_("RHN Entitlement Certificate sync")])
+ log2(1, 3, ["", _("RHN Entitlement Certificate sync")])
certSource = xmlWireSource.CertWireSource(self.systemid, self.sslYN,
self.xml_dump_version)
cert = string.strip(certSource.download())
@@ -648,10 +648,10 @@ Please contact your RHN representative""") %
(generation, sat_cert.generation))
if self.mountpoint:
for substream in stream:
h.process(substream)
- doEOSYN=0
+ doEOSYN = 0
else:
h.process(stream)
- doEOSYN=1
+ doEOSYN = 1
h.close()
@@ -2089,7 +2089,7 @@ def processCommandline():
# we take extra commandline arguments that are not linked to an option
if args:
msg = _("ERROR: these arguments make no sense in this context (try --help):
%s") % repr(args)
- log2stderr(-1, msg, 1,1)
+ log2stderr(-1, msg, 1, 1)
sys.exit(19)
#
@@ -2135,7 +2135,7 @@ def processCommandline():
_(" 2 - normal level of logging/messaging."),
_(" 3 - lots of logging/messaging."),
_(" 4+ - excessive logging/messaging.")]
- log(-1, msg, 1,1,sys.stderr)
+ log(-1, msg, 1, 1, sys.stderr)
sys.exit(21)
else:
CFG.set('DEBUG', debugLevel)
@@ -2176,7 +2176,7 @@ def processCommandline():
OPTIONS.step = stepHierarchy[-1]
if OPTIONS.step not in stepHierarchy:
- log2stderr(-1, _("ERROR: '%s' is not a valid step. See 'man
satellite-sync' for more detail.") % OPTIONS.step, 1,1)
+ log2stderr(-1, _("ERROR: '%s' is not a valid step. See 'man
satellite-sync' for more detail.") % OPTIONS.step, 1, 1)
sys.exit(22)
#XXX: --source is deferred for the time being
@@ -2315,7 +2315,7 @@ def processCommandline():
_(" 25 - no such directory"),
_(" 26 - mount_point does not exist"),
_(" 27 - No such org"),]
- log(-1, msg, 1,1,sys.stderr)
+ log(-1, msg, 1, 1, sys.stderr)
sys.exit(0)
if OPTIONS.dump_version:
commit 7091ad68703e5c4287c1a3331a70ef849277ac1c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 23 15:31:20 2010 +0100
only fixed pylint errors
no code changes
diff --git a/utils/spacewalk-common-channels b/utils/spacewalk-common-channels
index 96ce854..b22f8cf 100755
--- a/utils/spacewalk-common-channels
+++ b/utils/spacewalk-common-channels
@@ -27,9 +27,8 @@ DEFAULT_PASSWORD = "spacewalk"
DEFAULT_CONFIG = '/etc/rhn/spacewalk-common-channels.ini'
-channel_arch = {
+CHANNEL_ARCH = {
'i386': 'channel-ia32',
- 'x86_64': 'channel-x86_64',
'ia64': 'channel-ia64',
'sparc': 'channel-sparc',
'sparc64': 'channel-sparc64',
@@ -47,8 +46,11 @@ channel_arch = {
SPLIT_PATTERN = '[ ,]+'
-# extend OptionParser to print examples
-class xOptionParser(OptionParser):
+class ExtOptionParser(OptionParser):
+ """extend OptionParser to print examples"""
+ def __init__(self, examples=None, **kwargs):
+ self.examples = examples
+ OptionParser.__init__(self, **kwargs)
def print_help(self):
OptionParser.print_help(self)
print "\n\n" + self.examples
@@ -69,11 +71,13 @@ def connect(user, password, server):
def add_channels(channels, section, arch):
base_channels = ['']
optional = ['activationkey', 'base_channel_activationkey',
'gpgkey_url',
- 'gpgkey_id', 'gpgkey_fingerprint',
'yumrepo_url', 'yum_repo_label']
+ 'gpgkey_id', 'gpgkey_fingerprint',
'yumrepo_url',
+ 'yum_repo_label']
mandatory = ['label', 'name', 'summary', 'checksum',
'arch']
if config.has_option(section, 'base_channels'):
- base_channels = re.split(SPLIT_PATTERN, config.get(section,
'base_channels', 1))
+ base_channels = re.split(SPLIT_PATTERN,
+ config.get(section, 'base_channels', 1))
config.set(section, 'arch', arch)
config.set(section, 'section', section)
@@ -86,11 +90,11 @@ def add_channels(channels, section, arch):
# there isn't such base channel so skip also child
continue
# set base channel values so they can be used as macros
- for (k,v) in channels[channel['base_channel']].items():
+ for (k, v) in channels[channel['base_channel']].items():
config.set(section, 'base_channel_' + k, v)
for k in optional:
- if config.has_option(section,k):
+ if config.has_option(section, k):
channel[k] = config.get(section, k)
else:
channel[k] = ''
@@ -120,12 +124,16 @@ Create everything as well as unlimited activation key for every
channel:
\n""" % {'prog': sys.argv[0]}
option_list = [
- Option("-c", "--config", help="configuration file",
default=DEFAULT_CONFIG),
+ Option("-c", "--config", help="configuration
file",
+ default=DEFAULT_CONFIG),
Option("-u", "--user", help="username",
default=DEFAULT_USER),
Option("-p", "--password", help="password",
default=DEFAULT_PASSWORD),
- Option("-s", "--server", help="your spacewalk
server", default=DEFAULT_SERVER),
- Option("-k", "--keys", help="activation key usage limit
- 'unlimited' or number\n"
- + "(default: options is not set and activation keys are not
created at all)",
+ Option("-s", "--server", help="your spacewalk
server",
+ default=DEFAULT_SERVER),
+ Option("-k", "--keys", help="activation key usage limit
-"
+ + " 'unlimited' or number\n"
+ + "(default: options is not set and activation keys"
+ + " are not created at all)",
dest="key_limit"),
Option("-n", "--dry-run", help="perform a trial run with
no changes made",
action="store_true"),
@@ -135,8 +143,7 @@ Create everything as well as unlimited activation key for every
channel:
action="store_true"),
]
- parser = xOptionParser(usage=usage, option_list=option_list)
- parser.examples = examples
+ parser = ExtOptionParser(usage=usage, option_list=option_list, examples=examples)
(options, args) = parser.parse_args()
config = ConfigParser.ConfigParser()
config.read(options.config)
@@ -166,7 +173,7 @@ Create everything as well as unlimited activation key for every
channel:
if config.has_option(section, 'base_channels'): # child
sections.append(section)
else: # base
- sections.insert(0,section)
+ sections.insert(0, section)
for section in sections:
archs = re.split(SPLIT_PATTERN, config.get(section, 'archs'))
if options.archs:
@@ -201,22 +208,26 @@ Create everything as well as unlimited activation key for every
channel:
if key == None:
try:
- client, key = connect(options.user, options.password, options.server)
+ client, key = connect(options.user, options.password,
+ options.server)
user_info = client.user.getDetails(key, options.user)
org_id = user_info['org_id']
except xmlrpclib.Fault, e:
if e.faultCode == 2950:
- sys.stderr.write("Either the password or username is
incorrect.\n")
+ sys.stderr.write(
+ "Either the password or username is incorrect.\n")
sys.exit(2)
else:
- raise e
+ raise e
if create_channel:
base_info = channels[base_channel_label]
if options.verbose:
- sys.stdout.write("Base channel '%s' - creating...\n" %
base_info['name'])
+ sys.stdout.write("Base channel '%s' - creating...\n"
+ % base_info['name'])
if options.verbose > 1:
- sys.stdout.write("* label=%s, summary=%s, arch=%s,
checksum=%s\n" % (
+ sys.stdout.write(
+ "* label=%s, summary=%s, arch=%s, checksum=%s\n" % (
base_info['label'],
base_info['summary'],
base_info['arch'],
base_info['checksum']))
@@ -224,13 +235,15 @@ Create everything as well as unlimited activation key for every
channel:
try:
# create base channel
client.channel.software.create(key,
- base_info['label'], base_info['name'],
base_info['summary'],
- channel_arch[base_info['arch']], '',
base_info['checksum'],
+ base_info['label'], base_info['name'],
+ base_info['summary'],
CHANNEL_ARCH[base_info['arch']],
+ '', base_info['checksum'],
{ 'url': base_info['gpgkey_url'],
'id' : base_info['gpgkey_id'],
'fingerprint':
base_info['gpgkey_fingerprint']})
client.channel.software.createRepo(key,
- base_info['yum_repo_label'], 'yum',
base_info['yumrepo_url'])
+ base_info['yum_repo_label'], 'yum',
+ base_info['yumrepo_url'])
client.channel.software.associateRepo(key,
base_info['label'],
base_info['yum_repo_label'])
except xmlrpclib.Fault, e:
@@ -246,12 +259,13 @@ Create everything as well as unlimited activation key for every
channel:
if not options.dry_run:
# create activation key
if options.key_limit == 'unlimited':
- ak_args = (key, base_info['activationkey'],
base_info['name'],
- base_info['label'], [], False)
- else:
- ak_args = (key, base_info['activationkey'],
base_info['name'],
- base_info['label'],
int(options.key_limit),
+ ak_args = (key, base_info['activationkey'],
+ base_info['name'],
base_info['label'],
[], False)
+ else:
+ ak_args = (key, base_info['activationkey'],
+ base_info['name'],
base_info['label'],
+ int(options.key_limit), [], False)
try:
client.activationkey.create(*ak_args)
except xmlrpclib.Fault, e:
@@ -260,9 +274,11 @@ Create everything as well as unlimited activation key for every
channel:
else:
# check whether channel exists
try:
- base_info = client.channel.software.getDetails(key, base_channel_label)
+ base_info = client.channel.software.getDetails(key,
+ base_channel_label)
if options.verbose:
- sys.stdout.write("Base channel '%s' - exists\n" %
base_info['name'])
+ sys.stdout.write("Base channel '%s' - exists\n"
+ % base_info['name'])
except xmlrpclib.Fault, e:
if e.faultCode != -210: # don't report 'No such channel'
sys.stderr.write("ERROR: %s: %s\n" % (
@@ -272,10 +288,12 @@ Create everything as well as unlimited activation key for every
channel:
for child_channel_label in sorted(child_channels[base_channel_label]):
child_info = channels[child_channel_label]
if options.verbose:
- sys.stdout.write("* Child channel '%s' - creating...\n"
% child_info['name'])
+ sys.stdout.write("* Child channel '%s' -
creating...\n"
+ % child_info['name'])
if options.verbose > 1:
- sys.stdout.write("** label=%s, summary=%s, arch=%s, parent=%s,
checksum=%s\n" % (
- child_info['label'],
child_info['summary'],
+ sys.stdout.write(
+ "** label=%s, summary=%s, arch=%s, parent=%s,
checksum=%s\n"
+ % ( child_info['label'],
child_info['summary'],
child_info['arch'], base_channel_label,
child_info['checksum']))
@@ -283,14 +301,16 @@ Create everything as well as unlimited activation key for every
channel:
try:
# create child channels
client.channel.software.create(key,
- child_info['label'], child_info['name'],
child_info['summary'],
- channel_arch[child_info['arch']],
base_channel_label,
+ child_info['label'], child_info['name'],
+ child_info['summary'],
+ CHANNEL_ARCH[child_info['arch']],
base_channel_label,
child_info['checksum'],
{ 'url': child_info['gpgkey_url'],
'id' : child_info['gpgkey_id'],
'fingerprint':
child_info['gpgkey_fingerprint']})
client.channel.software.createRepo(key,
- child_info['yum_repo_label'], 'yum',
child_info['yumrepo_url'])
+ child_info['yum_repo_label'], 'yum',
+ child_info['yumrepo_url'])
client.channel.software.associateRepo(key,
child_info['label'],
child_info['yum_repo_label'])
except xmlrpclib.Fault, e:
@@ -304,12 +324,13 @@ Create everything as well as unlimited activation key for every
channel:
activationkey = "%s-%s" % (
org_id,
child_info['base_channel_activationkey'])
if options.verbose:
- sys.stdout.write("** Activation key '%s' - adding
child channel...\n" % (
+ sys.stdout.write(
+ "** Activation key '%s' - adding child
channel...\n" % (
activationkey))
if not options.dry_run:
try:
- client.activationkey.addChildChannels(key, activationkey,
-
[child_info['label']])
+ client.activationkey.addChildChannels(key,
+ activationkey, [child_info['label']])
except xmlrpclib.Fault, e:
sys.stderr.write("ERROR: %s: %s\n" % (
child_info['label'], e.faultString))
commit 5bee8fdc9201cf2478f71a3843376943d2af0803
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 23 14:47:01 2010 +0100
added spacewalk 1.2 channels and repos
diff --git a/utils/spacewalk-common-channels.ini b/utils/spacewalk-common-channels.ini
index 0b918bf..2ac6c71 100644
--- a/utils/spacewalk-common-channels.ini
+++ b/utils/spacewalk-common-channels.ini
@@ -297,3 +297,76 @@ gpgkey_id = %(_spacewalk_gpgkey_id)s
gpgkey_fingerprint = %(_spacewalk_gpgkey_fingerprint)s
yumrepo_url =
http://spacewalk.redhat.com/yum/1.1-client/Fedora/13/%(arch)s/
+
+[spacewalk12-server-centos5]
+name = Spacewalk Server 1.2 for %(base_channel_name)s
+archs = i386, x86_64
+base_channels = centos5-%(arch)s
+gpgkey_url = %(_spacewalk_gpgkey_url)s
+gpgkey_id = %(_spacewalk_gpgkey_id)s
+gpgkey_fingerprint = %(_spacewalk_gpgkey_fingerprint)s
+yumrepo_url =
http://spacewalk.redhat.com/yum/1.2/RHEL/5/%(arch)s/
+
+[spacewalk12-server-fedora12]
+name = Spacewalk Server 1.2 for %(base_channel_name)s
+archs = i386, x86_64
+base_channels = fedora12-%(arch)s
+gpgkey_url = %(_spacewalk_gpgkey_url)s
+gpgkey_id = %(_spacewalk_gpgkey_id)s
+gpgkey_fingerprint = %(_spacewalk_gpgkey_fingerprint)s
+yumrepo_url =
http://spacewalk.redhat.com/yum/1.2/Fedora/12/%(arch)s/
+
+[spacewalk12-server-fedora13]
+name = Spacewalk Server 1.2 for %(base_channel_name)s
+archs = i386, x86_64
+base_channels = fedora13-%(arch)s
+gpgkey_url = %(_spacewalk_gpgkey_url)s
+gpgkey_id = %(_spacewalk_gpgkey_id)s
+gpgkey_fingerprint = %(_spacewalk_gpgkey_fingerprint)s
+yumrepo_url =
http://spacewalk.redhat.com/yum/1.2/Fedora/13/%(arch)s/
+
+[spacewalk12-server-fedora14]
+name = Spacewalk Server 1.2 for %(base_channel_name)s
+archs = i386, x86_64
+base_channels = fedora14-%(arch)s
+gpgkey_url = %(_spacewalk_gpgkey_url)s
+gpgkey_id = %(_spacewalk_gpgkey_id)s
+gpgkey_fingerprint = %(_spacewalk_gpgkey_fingerprint)s
+yumrepo_url =
http://spacewalk.redhat.com/yum/1.2/Fedora/14/%(arch)s/
+
+
+[spacewalk12-client-centos5]
+name = Spacewalk Client 1.2 for %(base_channel_name)s
+archs = i386, x86_64
+base_channels = centos5-%(arch)s
+gpgkey_url = %(_spacewalk_gpgkey_url)s
+gpgkey_id = %(_spacewalk_gpgkey_id)s
+gpgkey_fingerprint = %(_spacewalk_gpgkey_fingerprint)s
+yumrepo_url =
http://spacewalk.redhat.com/yum/1.2-client/RHEL/5/%(arch)s/
+
+[spacewalk12-client-fedora12]
+name = Spacewalk Client 1.2 for %(base_channel_name)s
+archs = i386, x86_64
+base_channels = fedora12-%(arch)s
+gpgkey_url = %(_spacewalk_gpgkey_url)s
+gpgkey_id = %(_spacewalk_gpgkey_id)s
+gpgkey_fingerprint = %(_spacewalk_gpgkey_fingerprint)s
+yumrepo_url =
http://spacewalk.redhat.com/yum/1.2-client/Fedora/12/%(arch)s/
+
+[spacewalk12-client-fedora13]
+name = Spacewalk Client 1.2 for %(base_channel_name)s
+archs = i386, x86_64
+base_channels = fedora13-%(arch)s
+gpgkey_url = %(_spacewalk_gpgkey_url)s
+gpgkey_id = %(_spacewalk_gpgkey_id)s
+gpgkey_fingerprint = %(_spacewalk_gpgkey_fingerprint)s
+yumrepo_url =
http://spacewalk.redhat.com/yum/1.2-client/Fedora/13/%(arch)s/
+
+[spacewalk12-client-fedora14]
+name = Spacewalk Client 1.2 for %(base_channel_name)s
+archs = i386, x86_64
+base_channels = fedora14-%(arch)s
+gpgkey_url = %(_spacewalk_gpgkey_url)s
+gpgkey_id = %(_spacewalk_gpgkey_id)s
+gpgkey_fingerprint = %(_spacewalk_gpgkey_fingerprint)s
+yumrepo_url =
http://spacewalk.redhat.com/yum/1.2-client/Fedora/14/%(arch)s/
commit 3c2816d189ba65dd603f2e2ac554472be63061fa
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 23 12:17:17 2010 +0100
removed unused variable
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index f263956..d9826e3 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -223,8 +223,6 @@ class RepoSync:
rel_package_path = rhnPackageUpload.relative_path_from_header(
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_type, package.checksum,
force=False,
commit 47fbf788b47b4e6018a79b97326c2453ec6271f7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 23 10:11:23 2010 +0100
fixed Notification Methods (PG)
ERROR: missing FROM-clause entry for table "rhn_contact_methods_recid_seq"
at character
diff --git a/web/modules/rhn/RHN/DB/ContactMethod.pm
b/web/modules/rhn/RHN/DB/ContactMethod.pm
index 5088752..7b2f6ab 100644
--- a/web/modules/rhn/RHN/DB/ContactMethod.pm
+++ b/web/modules/rhn/RHN/DB/ContactMethod.pm
@@ -175,7 +175,7 @@ sub commit {
my $dbh = RHN::DB->connect;
# Get the next recid from the sequence and set it as the id for this instance.
- my $sth = $dbh->prepare("SELECT " . $self->get_sequence .
".nextval FROM DUAL");
+ my $sth = $dbh->prepare("SELECT sequence_nextval('" .
$self->get_sequence . "') FROM DUAL");
$sth->execute;
my ($pk_value) = $sth->fetchrow;
die "No new $type $pk from seq " . $self->get_sequence . "
(possible error: " . $sth->errstr . ")" unless $pk_value;
commit 603b66ee63f2af1b5e620eda8dc89e0383528bf8
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 23 09:48:11 2010 +0100
fixed Notification Methods (PG)
ERROR: function decode(character varying, unknown, character varying,
unknown, character varying) does not exist at character 70
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/contact_method_queries.xml
b/web/modules/rhn/RHN/DB/DataSource/xml/contact_method_queries.xml
index 394a66e..579f176 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/contact_method_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/contact_method_queries.xml
@@ -8,9 +8,9 @@
<query params="user_id">
SELECT CM.recid recid,
CM.method_name method_name,
- DECODE( MT.method_type_name,
- 'Email', CM.email_address,
- 'Pager', CM.pager_email) method_target
+ CASE MT.method_type_name
+ WHEN 'Email' THEN CM.email_address
+ WHEN 'Pager' THEN CM.pager_email END method_target
FROM rhn_contact_methods CM, rhn_method_types MT
WHERE CM.method_type_id = MT.recid
AND CM.contact_id = :user_id