backend/satellite_tools/disk_dumper/dumper.py | 12
backend/satellite_tools/disk_dumper/iss.py | 301 +++++++++++++---------
backend/satellite_tools/exporter/exportLib.py | 24 -
backend/satellite_tools/exporter/xmlWriter.py | 6
backend/satellite_tools/geniso.py | 2
backend/satellite_tools/progress_bar.py | 8
backend/satellite_tools/reposync.py | 8
backend/satellite_tools/rhn_satellite_activate.py | 10
backend/satellite_tools/satCerts.py | 86 +++---
backend/satellite_tools/sync_handlers.py | 22 -
backend/satellite_tools/xmlSource.py | 10
backend/spacewalk-backend.spec | 5
rel-eng/packages/spacewalk-backend | 2
13 files changed, 276 insertions(+), 220 deletions(-)
New commits:
commit dcd84e19e9ccc627b697d118897043df153a5f57
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 31 15:25:08 2012 +0200
Automatic commit of package [spacewalk-backend] release [1.8.64-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index ed54ec1..0c2dbfa 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -12,7 +12,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 1.8.63
+Version: 1.8.64
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -647,6 +647,9 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Fri Aug 31 2012 Michael Mraka <michael.mraka(a)redhat.com> 1.8.64-1
+- fixed pylint errors
+
* Mon Aug 27 2012 Stephen Herr <sherr(a)redhat.com> 1.8.63-1
- 848475 - Adding IPv6 ip-address detection to proxy auth fix
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index 627daee..c4341d3 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-1.8.63-1 backend/
+1.8.64-1 backend/
commit 0da279d6cc4317a9c528c2348cfa513b93d6c06f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:56:04 2012 +0200
fixed indentation with tabs instead of spaces
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 0c26f98..0c2967b 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -186,7 +186,7 @@ class RepoSync(object):
'arch' : pkg['arch'],
'channel_id' : int(self.channel['id']),
}
- if pkg['epoch'] == '0':
+ if pkg['epoch'] == '0':
epochStatement = "(pevr.epoch is NULL or pevr.epoch =
'0')"
elif pkg['epoch'] is None or pkg['epoch'] == '':
epochStatement = "pevr.epoch is NULL"
@@ -334,7 +334,7 @@ class RepoSync(object):
# package is already in the channel
to_link = False
elif db_pack['channel_id'] == channel_id:
- # different package with SAME NVREA
+ # different package with SAME NVREA
self.disassociate_package(db_pack)
if to_download or to_link:
@@ -428,9 +428,9 @@ class RepoSync(object):
where c.checksum = :checksum
and c.checksum_type = :checksum_type
)
- """)
+ """)
h.execute(channel_id=self.channel['id'],
- checksum_type=pack['checksum_type'], checksum=pack['checksum'])
+ checksum_type=pack['checksum_type'],
checksum=pack['checksum'])
def _importer_run(self, package, caller, backend):
importer = ChannelPackageSubscription(
commit ea768812dccb41efa8a8357e5110c2c0637610d9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:55:32 2012 +0200
fixed indentation with tabs instead of spaces
diff --git a/backend/satellite_tools/disk_dumper/dumper.py
b/backend/satellite_tools/disk_dumper/dumper.py
index 2afaaae..9370a39 100644
--- a/backend/satellite_tools/disk_dumper/dumper.py
+++ b/backend/satellite_tools/disk_dumper/dumper.py
@@ -63,7 +63,7 @@ class XML_Dumper:
def get_channel_families_statement_new(self, cids):
args = {
- 'ch_ids' : cids
+ 'ch_ids' : cids
}
query = """
@@ -77,10 +77,10 @@ class XML_Dumper:
def get_channels_statement(self):
query = """
select c.id channel_id, c.label,
- ct.label as checksum_type,
+ ct.label as checksum_type,
TO_CHAR(c.last_modified, 'YYYYMMDDHH24MISS') last_modified
from rhnChannel c left outer join rhnChecksumType ct on c.checksum_type_id
= ct.id,
- rhnChannelFamilyMembers cfm,
+ rhnChannelFamilyMembers cfm,
(%s
) scf
where scf.channel_family_id = cfm.channel_family_id
@@ -431,7 +431,7 @@ class XML_Dumper:
all_channels_hash[row['label']] = row
# Intersect the list of channels they've sent to us
- iss_slave_sha256_capable =
(float(rhnFlags.get('X-RHN-Satellite-XML-Dump-Version')) >=
constants.SHA256_SUPPORTED_VERSION)
+ iss_slave_sha256_capable =
(float(rhnFlags.get('X-RHN-Satellite-XML-Dump-Version')) >=
constants.SHA256_SUPPORTED_VERSION)
if not channel_labels:
channels = all_channels_hash
@@ -610,7 +610,7 @@ class CachedDumper(exportLib.BaseDumper):
hash_factor = 1
key_template = 'dump/%s/dump-%s.xml'
def __init__(self, writer, params):
- statement = rhnSQL.prepare(self.iterator_query)
+ statement = rhnSQL.prepare(self.iterator_query)
iterator = CachedQueryIterator(statement, params,
cache_get=self.cache_get)
exportLib.BaseDumper.__init__(self, writer, data_iterator=iterator)
@@ -664,7 +664,7 @@ class CachedDumper(exportLib.BaseDumper):
class ChannelsDumper(exportLib.ChannelsDumper):
_query_list_channels = rhnSQL.Statement("""
select c.id, c.org_id,
- c.label, ca.label channel_arch, c.basedir, c.name,
+ c.label, ca.label channel_arch, c.basedir, c.name,
c.summary, c.description, c.gpg_key_url,
ct.label checksum_type,
TO_CHAR(c.last_modified, 'YYYYMMDDHH24MISS') last_modified,
commit 5b2f44ada19c81c4833502f2de8b215ef50b1206
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:54:31 2012 +0200
fixed indentation with tabs instead of spaces
diff --git a/backend/satellite_tools/sync_handlers.py
b/backend/satellite_tools/sync_handlers.py
index e5f1051..826015a 100644
--- a/backend/satellite_tools/sync_handlers.py
+++ b/backend/satellite_tools/sync_handlers.py
@@ -427,7 +427,7 @@ class ContainerHandler:
self.setChannelPackageArchContainer()
# all other containers
self.setChannelFamilyContainer()
- self.setProductNamesContainer()
+ self.setProductNamesContainer()
def __del__(self):
self.handler.close() # kill the circular reference.
@@ -529,7 +529,7 @@ def populate_channel_family_permissions(cert):
# Bugs 171160, 183365: We can't assume that the satellite already knows
# about rh-public (it may not yet know about any channels).
if current_cfs.has_key("rh-public"):
- cert_chfam_hash["rh-public"] = None
+ cert_chfam_hash["rh-public"] = None
for cf in cert.channel_families:
if not current_cfs.has_key(cf.name):
@@ -569,14 +569,14 @@ def populate_channel_family_permissions(cert):
org_id = None
else:
max_members, max_flex = max_tuple
- # default the org to 1 for channel families from cert
+ # default the org to 1 for channel families from cert
org_id = 1
cf_name = cf_name.encode('utf-8')
try:
- old_max_tuple = cfps[(cf_name, org_id)]
+ old_max_tuple = cfps[(cf_name, org_id)]
except KeyError:
- # New channel family, populate the db from cert
+ # New channel family, populate the db from cert
cfps[(cf_name, org_id)] = max_tuple
old_max_tuple = None
@@ -584,22 +584,22 @@ def populate_channel_family_permissions(cert):
sum_max_values = compute_sum_max_members(cfps)
for (cf_name, org_id), (max_members, max_flex) in cfps.items():
if org_id == 1:
- if cert_chfam_hash.has_key(cf_name):
+ if cert_chfam_hash.has_key(cf_name):
cert_max_value = cert_chfam_hash[cf_name][0] or 0
cert_max_flex = cert_chfam_hash[cf_name][1] or 0
else:
- # remove entitlements on extra slots
+ # remove entitlements on extra slots
cfps[(cf_name, org_id)] = None
continue
if not max_members:
- max_members = 0
+ max_members = 0
if not max_flex:
max_flex = 0
(sum_max_mem, sum_max_flex) = sum_max_values[cf_name]
if cert_max_value >= sum_max_mem:
cfps[(cf_name, 1)][0] = max_members + \
- (cert_max_value - sum_max_mem)
+ (cert_max_value - sum_max_mem)
else:
purge_count = sum_max_mem - cert_max_value
cfps[(cf_name, 1)][0] = max_members - purge_count
@@ -708,7 +708,7 @@ _query_purge_private_channel_families =
rhnSQL.Statement("""
def purge_extra_channel_families():
# Get rid of the extra channel families
try:
- # Purge all unused private channel families with null org
+ # Purge all unused private channel families with null org
h = rhnSQL.prepare(_query_purge_private_channel_families)
h.execute()
except rhnSQL.SQLError, e:
commit 4b8327a1183ab28465d2cdb0d0a2049f11a8d3a9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:53:45 2012 +0200
fixed indentation with tabs instead of spaces
diff --git a/backend/satellite_tools/rhn_satellite_activate.py
b/backend/satellite_tools/rhn_satellite_activate.py
index 2547be8..298c18e 100644
--- a/backend/satellite_tools/rhn_satellite_activate.py
+++ b/backend/satellite_tools/rhn_satellite_activate.py
@@ -306,9 +306,9 @@ def activateSatellite_remote(options):
ret = s.satellite.activate_satellite(systemid, rhn_cert)
except rpclib.xmlrpclib.Fault, f:
sys.stderr.write("Error reported from RHN: %s\n" % f)
- # NOTE: we support the old (pre-cactus) web-handler API and the new.
- # The old web handler used faultCodes of 1|-1 and the new API uses
- # faultCodes in the range [1020, ..., 1039]
+ # NOTE: we support the old (pre-cactus) web-handler API and the new.
+ # The old web handler used faultCodes of 1|-1 and the new API uses
+ # faultCodes in the range [1020, ..., 1039]
if oldApiYN and abs(f.faultCode) == 1:
sys.stderr.write(
'ERROR: error upon attempt to activate this %s\n'
@@ -633,10 +633,10 @@ def main():
except PopulateChannelFamiliesException, e:
writeError(e)
return 40
- else:
+ else:
# We're disconnected so we'll only update the channels we
# already know about.
- localUpdateChannels()
+ localUpdateChannels()
return 0
commit e7c229764325dfbe2a2ef8145301fe3671a276f0
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:51:49 2012 +0200
fixed bad indentation
diff --git a/backend/satellite_tools/sync_handlers.py
b/backend/satellite_tools/sync_handlers.py
index 32d5638..e5f1051 100644
--- a/backend/satellite_tools/sync_handlers.py
+++ b/backend/satellite_tools/sync_handlers.py
@@ -542,7 +542,7 @@ def populate_channel_family_permissions(cert):
quant = int(quant)
flex = cf.flex
if flex == '':
- flex = 0
+ flex = 0
if flex is not None:
flex = int(flex)
commit 3122c6ffae948819e347cbd0d5991a4677e86014
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:51:07 2012 +0200
fixed bad indentation
diff --git a/backend/satellite_tools/xmlSource.py b/backend/satellite_tools/xmlSource.py
index a585e88..9dcc5ae 100644
--- a/backend/satellite_tools/xmlSource.py
+++ b/backend/satellite_tools/xmlSource.py
@@ -987,11 +987,11 @@ def _normalizeAttribute(objtype, attribute):
# (Don't know how to handle it) or (Expecting a scalar)
return attribute
elif objtype is types.IntType:
- if attribute == '' or attribute == 'None':
- # Treat it as NULL
- return None
- else:
- return int(attribute)
+ if attribute == '' or attribute == 'None':
+ # Treat it as NULL
+ return None
+ else:
+ return int(attribute)
elif objtype is importLib.DateType:
return _normalizeDateType(attribute)
elif isinstance(objtype, types.ListType):
commit 56c53fb14cd4fc0face1d292a112fbbe606b4b66
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:50:00 2012 +0200
fixed bad indentation
diff --git a/backend/satellite_tools/geniso.py b/backend/satellite_tools/geniso.py
index 405dd17..ab05e0a 100644
--- a/backend/satellite_tools/geniso.py
+++ b/backend/satellite_tools/geniso.py
@@ -210,7 +210,7 @@ def sizeStrToInt(s):
# The visitfunc argument for os.path.walk
def __visitfunc(arg, dirname, names):
- for f in names:
+ for f in names:
filename = os.path.normpath("%s/%s" % (dirname, f))
if os.path.isdir(filename):
# walk will process it later
commit a66fe3c39552629e234e183967d045165b738ead
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:49:21 2012 +0200
fixed bad indentation
diff --git a/backend/satellite_tools/satCerts.py b/backend/satellite_tools/satCerts.py
index 1d20f90..bfe238b 100644
--- a/backend/satellite_tools/satCerts.py
+++ b/backend/satellite_tools/satCerts.py
@@ -43,15 +43,15 @@ class CertVersionMismatchError(Exception):
def __init__(self, old_version, new_version):
self._message = "the versions of current and new certificate do not match,
[%s] vs. [%s]" % (old_version, new_version)
def __str__(self):
- return self._message
+ return self._message
class NoFreeEntitlementsError(Exception):
def __init__(self, label, quantity):
- self.label = label
- self.quantity = quantity
- self.message = \
- "Error: You do not have enough unused %s entitlements in the base org. You
will need at least %s free entitlements, based on your current consumption. Please
un-entitle the remaining systems for the activation to proceed." % (self.label,
self.quantity)
- self.args = [self.message]
+ self.label = label
+ self.quantity = quantity
+ self.message = \
+ "Error: You do not have enough unused %s entitlements in the base org. You
will need at least %s free entitlements, based on your current consumption. Please
un-entitle the remaining systems for the activation to proceed." % (self.label,
self.quantity)
+ self.args = [self.message]
def get_all_orgs():
""" Fetch org_id. Create first org_id if needed.
@@ -382,16 +382,16 @@ def set_slots_from_cert(cert, testonly=False):
del extra_slots[slot_type_id]
if sys_ent_total_max.has_key(db_label) and \
- sys_ent_total_max[db_label] is not None:
- # Do the math only if the slot already exists
- if sys_ent_total_max[db_label] > int(quantity):
- # If cert count is lower than existing db slot
- purge_count = sys_ent_total_max[db_label] - int(quantity)
- quantity = sys_ent_counts[(db_label, 1)] - purge_count
+ sys_ent_total_max[db_label] is not None:
+ # Do the math only if the slot already exists
+ if sys_ent_total_max[db_label] > int(quantity):
+ # If cert count is lower than existing db slot
+ purge_count = sys_ent_total_max[db_label] - int(quantity)
+ quantity = sys_ent_counts[(db_label, 1)] - purge_count
- else:
- # If cert is higher take the extra count and add to max
- quantity = sys_ent_counts[(db_label, 1)] + \
+ else:
+ # If cert is higher take the extra count and add to max
+ quantity = sys_ent_counts[(db_label, 1)] + \
(int(quantity) - sys_ent_total_max[db_label])
try:
@@ -713,34 +713,34 @@ def _test_store_rhnCryptoKey(caCert):
store_rhnCryptoKey(description, caCert)
def create_first_private_chan_family():
- """
- Check to see if org has a channelfamily associated with it.
- If not, Create one.
- """
- _lookup_chfam = """
- SELECT 1 from rhnChannelFamily
- WHERE label='private-channel-family-1'
- """
- h = rhnSQL.prepare(_lookup_chfam)
- row = h.execute()
- # some extra check for upgrades
- if row:
- # Already exists, move on
- return
- _query_create_chfam = """
- INSERT INTO rhnChannelFamily
- (id, name, label, org_id, product_url)
- VALUES (sequence_nextval('rhn_channel_family_id_seq'), :name, :label,
:org, :url)
-
- """
- h = rhnSQL.prepare(_query_create_chfam)
- try:
- h.execute(name='Private Channel Family 1', \
- label='private-channel-family-1', \
- org=1, url='First Org Created')
- except rhnSQL.SQLError, e:
- # if we're here that means we're voilating something
- raise
+ """
+ Check to see if org has a channelfamily associated with it.
+ If not, Create one.
+ """
+ _lookup_chfam = """
+ SELECT 1 from rhnChannelFamily
+ WHERE label='private-channel-family-1'
+ """
+ h = rhnSQL.prepare(_lookup_chfam)
+ row = h.execute()
+ # some extra check for upgrades
+ if row:
+ # Already exists, move on
+ return
+ _query_create_chfam = """
+ INSERT INTO rhnChannelFamily
+ (id, name, label, org_id, product_url)
+ VALUES (sequence_nextval('rhn_channel_family_id_seq'), :name, :label,
:org, :url)
+
+ """
+ h = rhnSQL.prepare(_query_create_chfam)
+ try:
+ h.execute(name='Private Channel Family 1', \
+ label='private-channel-family-1', \
+ org=1, url='First Org Created')
+ except rhnSQL.SQLError, e:
+ # if we're here that means we're voilating something
+ raise
def verify_family_permissions(orgid=1):
commit abd6d55c1bf1030c8dc11e49100cce697d3562ab
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:40:00 2012 +0200
fixed Used builtin function 'apply'
diff --git a/backend/satellite_tools/exporter/exportLib.py
b/backend/satellite_tools/exporter/exportLib.py
index 616cbbc..aed6d87 100644
--- a/backend/satellite_tools/exporter/exportLib.py
+++ b/backend/satellite_tools/exporter/exportLib.py
@@ -48,7 +48,7 @@ class BaseDumper:
# Generic timing function
def timer(self, debug_level, message, function, *args, **kwargs):
start = time.time()
- result = apply(function, args, kwargs)
+ result = function(*args, **kwargs)
log_debug(debug_level, message, "timing: %.3f" % (time.time() -
start))
return result
commit 7ee126f6dda0da00db03101058f993e9f7bb28f0
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:37:48 2012 +0200
fixed __init__ method from a non direct base class 'BaseDumper' is called
diff --git a/backend/satellite_tools/exporter/exportLib.py
b/backend/satellite_tools/exporter/exportLib.py
index 87e6065..616cbbc 100644
--- a/backend/satellite_tools/exporter/exportLib.py
+++ b/backend/satellite_tools/exporter/exportLib.py
@@ -500,7 +500,7 @@ class ChannelsDumper(BaseSubelementDumper):
subelement_dumper_class = _ChannelDumper
def __init__(self, writer, channels=[]):
- BaseDumper.__init__(self, writer)
+ BaseSubelementDumper.__init__(self, writer)
self._channels = channels
def set_iterator(self):
@@ -611,7 +611,7 @@ class ChannelFamiliesDumper(BaseQueryDumper):
def __init__(self, writer, data_iterator=None, ignore_subelements=0,
null_max_members=1, virt_filter=0):
- BaseDumper.__init__(self, writer, data_iterator=data_iterator)
+ BaseQueryDumper.__init__(self, writer, data_iterator=data_iterator)
self._ignore_subelements = ignore_subelements
self._null_max_members = null_max_members
self.virt_filter = virt_filter
commit 7df8ba2293c33c3ca61ed4b4ecf62d800c40c742
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:32:59 2012 +0200
removed comments
diff --git a/backend/satellite_tools/exporter/exportLib.py
b/backend/satellite_tools/exporter/exportLib.py
index d9cbfc1..87e6065 100644
--- a/backend/satellite_tools/exporter/exportLib.py
+++ b/backend/satellite_tools/exporter/exportLib.py
@@ -1352,8 +1352,6 @@ class _KickstartableTreeDumper(BaseRowDumper):
def set_attributes(self):
row_dict = self._row.copy()
del dict['id']
- # XXX Should we export this one?
- #del dict['base-path']
last_modified = row_dict['last-modified']
row_dict['last-modified'] = _dbtime2timestamp(last_modified)
return row_dict
commit ce110979858bdf6f9e9d0bc46bfcd4fd0de3cc07
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:32:12 2012 +0200
fixed Redefining built-in 'dict'
diff --git a/backend/satellite_tools/exporter/exportLib.py
b/backend/satellite_tools/exporter/exportLib.py
index cb579c9..d9cbfc1 100644
--- a/backend/satellite_tools/exporter/exportLib.py
+++ b/backend/satellite_tools/exporter/exportLib.py
@@ -708,7 +708,7 @@ class _PackageDumper(BaseRowDumper):
"package_group", "rpm_version", "package_size",
"payload_size",
"installed_size", "build_host", "source_rpm",
"payload_format",
"compat"]
- dict = {
+ attr_dict = {
'id' : "rhn-package-%s" %
self._row['id'],
'org_id' : self._row['org_id'] or "",
'epoch' : self._row['epoch'] or "",
@@ -717,11 +717,11 @@ class _PackageDumper(BaseRowDumper):
'last-modified' :
_dbtime2timestamp(self._row['last_modified']),
}
for attr in attrs:
- dict[attr.replace('_', '-')] = self._row[attr]
+ attr_dict[attr.replace('_', '-')] = self._row[attr]
if self._row['checksum_type'] == 'md5':
# compatibility with older satellite
- dict['md5sum'] = self._row['checksum']
- return dict
+ attr_dict['md5sum'] = self._row['checksum']
+ return attr_dict
def set_iterator(self):
arr = []
@@ -1350,13 +1350,13 @@ class _KickstartableTreeDumper(BaseRowDumper):
tag_name = 'rhn-kickstartable-tree'
def set_attributes(self):
- dict = self._row.copy()
+ row_dict = self._row.copy()
del dict['id']
# XXX Should we export this one?
#del dict['base-path']
- last_modified = dict['last-modified']
- dict['last-modified'] = _dbtime2timestamp(last_modified)
- return dict
+ last_modified = row_dict['last-modified']
+ row_dict['last-modified'] = _dbtime2timestamp(last_modified)
+ return row_dict
def set_iterator(self):
kstree_id = self._row['id']
commit 29a677cda2b3f716ba729f02c12a8848aa1c0203
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:26:53 2012 +0200
fixed Dangerous default value {} as argument
diff --git a/backend/satellite_tools/exporter/xmlWriter.py
b/backend/satellite_tools/exporter/xmlWriter.py
index 06e1bae..894340a 100644
--- a/backend/satellite_tools/exporter/xmlWriter.py
+++ b/backend/satellite_tools/exporter/xmlWriter.py
@@ -52,18 +52,18 @@ class XMLWriter:
# Converts the string to the desired encoding
return unicode(s, self.charset).encode(self.encoding)
- def open_tag(self, name, attributes={}, namespace=None):
+ def open_tag(self, name, attributes=None, namespace=None):
"Opens a tag with the specified attributes"
return self._open_tag(None, name, attributes=attributes,
namespace=namespace)
- def empty_tag(self, name, attributes={}, namespace=None):
+ def empty_tag(self, name, attributes=None, namespace=None):
"Writes an empty tag with the specified attributes"
return self._open_tag(1, name, attributes=attributes,
namespace=namespace)
# Now the function that does most of the work for open_tag and empty_tag
- def _open_tag(self, empty, name, attributes={}, namespace=None):
+ def _open_tag(self, empty, name, attributes=None, namespace=None):
if namespace:
name = "%s:%s" % (namespace, name)
self.stream.write("<")
commit 2585a9ad97d78775309e9ba5231cd647ad9f0d98
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:09:16 2012 +0200
fixed String statement has no effect
diff --git a/backend/satellite_tools/disk_dumper/iss.py
b/backend/satellite_tools/disk_dumper/iss.py
index f8d154e..13cd0cd 100644
--- a/backend/satellite_tools/disk_dumper/iss.py
+++ b/backend/satellite_tools/disk_dumper/iss.py
@@ -59,11 +59,11 @@ class ISSChannelPackageShortDiskSource:
def _getFile(self):
return os.path.join(self.mp, self.pathkey % (self.channelid,))
-""" This class maps dumps to files. In other words, you give it
-the type of dump you're doing and it gives you the file to
-write it to.
-"""
class FileMapper:
+ """ This class maps dumps to files. In other words, you give it
+ the type of dump you're doing and it gives you the file to
+ write it to.
+ """
def __init__(self, mount_point):
self.mp = mount_point
self.filemap = {
@@ -148,11 +148,11 @@ class FileMapper:
self.filemap['kickstart_files'].set_relative_path(relative_path)
return self.setup_file(self.filemap['kickstart_files']._getFile())
-""" This class subclasses the XML_Dumper class. It overrides
- the _get_xml_writer method and adds a set_stream method,
- which will let it write to a file instead of over the wire.
-"""
class Dumper(dumper.XML_Dumper):
+ """ This class subclasses the XML_Dumper class. It overrides
+ the _get_xml_writer method and adds a set_stream method,
+ which will let it write to a file instead of over the wire.
+ """
def __init__(self, outputdir, channel_labels, hardlinks, start_date, \
end_date, use_rhn_date, whole_errata):
dumper.XML_Dumper.__init__(self)
commit fdc15fbb2918e02c3e1bf5f4acf6be818b674433
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 16:02:57 2012 +0200
fixed Line too long
diff --git a/backend/satellite_tools/disk_dumper/iss.py
b/backend/satellite_tools/disk_dumper/iss.py
index 1cbc933..f8d154e 100644
--- a/backend/satellite_tools/disk_dumper/iss.py
+++ b/backend/satellite_tools/disk_dumper/iss.py
@@ -657,7 +657,9 @@ class Dumper(dumper.XML_Dumper):
pb.printAll(1)
for channel in self.channel_ids:
self.set_filename(self.fm.getChannelsFile(channel['label']))
- dumper.XML_Dumper.dump_channels(self, [channel], self.start_date,
self.end_date, self.use_rhn_date, self.whole_errata)
+ dumper.XML_Dumper.dump_channels(self, [channel],
+ self.start_date, self.end_date,
+ self.use_rhn_date, self.whole_errata)
log2email(4, "Channel: %s" % channel['label'])
log2email(5, "Channel exported to %s" %
self.fm.getChannelsFile(channel['label']))
@@ -847,14 +849,18 @@ class Dumper(dumper.XML_Dumper):
pb.printAll(1)
for kickstart_file in self.kickstart_files:
#get the path to the kickstart files under the satellite's mount
point
- path_to_files = os.path.join(CFG.MOUNT_POINT,
kickstart_file['base-path'], kickstart_file['relative-path'])
+ path_to_files = os.path.join(CFG.MOUNT_POINT,
+ kickstart_file['base-path'],
+ kickstart_file['relative-path'])
#Make sure the path actually exists
if not os.path.exists(path_to_files):
raise ISSError("Missing kickstart file under satellite
mount-point: %s" % (path_to_files,), "")
#generate the path to the kickstart files under the export directory.
- path_to_export_file =
self.fm.getKickstartFileFile(kickstart_file['label'],
kickstart_file['relative-path'])
+ path_to_export_file = self.fm.getKickstartFileFile(
+ kickstart_file['label'],
+
kickstart_file['relative-path'])
#os.path.join(self.mp, kickstart_file['base-path'],
kickstart_file['relative-path'])
if os.path.exists(path_to_export_file):
# already exists, skip ks file
@@ -882,7 +888,9 @@ class Dumper(dumper.XML_Dumper):
e.__class__.__name__), tbout.getvalue()), \
None, sys.exc_info()[2]
- log2email(5, "Kickstart File: %s" %
os.path.join(kickstart_file['base-path'],
kickstart_file['relative-path']))
+ log2email(5, "Kickstart File: %s" %
+
os.path.join(kickstart_file['base-path'],
+ kickstart_file['relative-path']))
pb.addTo(1)
pb.printIncrement()
@@ -1101,21 +1109,27 @@ class ExporterMain:
#verify mountpoint
if os.access(self.outputdir, os.F_OK|os.R_OK|os.W_OK):
if os.path.isdir(self.outputdir):
- self.dumper = Dumper(self.outputdir, self.options.channel,
self.options.hard_links, start_date=self.start_date, end_date=self.end_date,
use_rhn_date=self.options.use_rhn_date, whole_errata=self.options.whole_errata)
+ self.dumper = Dumper(self.outputdir,
+ self.options.channel,
+ self.options.hard_links,
+ start_date=self.start_date,
+ end_date=self.end_date,
+ use_rhn_date=self.options.use_rhn_date,
+ whole_errata=self.options.whole_errata)
self.actionmap = {
- 'arches' : {'dump' :
self.dumper.dump_arches},
- 'arches-extra' : {'dump' :
self.dumper.dump_server_group_type_server_arches},
- 'blacklists' : {'dump' :
self.dumper.dump_blacklist_obsoletes},
- 'channel-families' : {'dump' :
self.dumper.dump_channel_families},
- 'channels' : {'dump' :
self.dumper.dump_channels},
- 'packages' : {'dump' :
self.dumper.dump_packages},
- 'short' : {'dump' :
self.dumper.dump_packages_short},
- #'channel-pkg-short' : {'dump'
: self.dumper.dump_channel_packages_short},
- #'source-packages' : {'dump'
: self.dumper.dump_source_packages},
- 'errata' : {'dump' :
self.dumper.dump_errata},
- 'kickstarts' : {'dump' :
[self.dumper.dump_kickstart_data,
+ 'arches' : {'dump' :
self.dumper.dump_arches},
+ 'arches-extra' : {'dump' :
self.dumper.dump_server_group_type_server_arches},
+ 'blacklists' : {'dump' :
self.dumper.dump_blacklist_obsoletes},
+ 'channel-families' : {'dump' :
self.dumper.dump_channel_families},
+ 'channels' : {'dump' :
self.dumper.dump_channels},
+ 'packages' : {'dump' :
self.dumper.dump_packages},
+ 'short' : {'dump' :
self.dumper.dump_packages_short},
+ #'channel-pkg-short' : {'dump' :
self.dumper.dump_channel_packages_short},
+ #'source-packages' : {'dump' :
self.dumper.dump_source_packages},
+ 'errata' : {'dump' :
self.dumper.dump_errata},
+ 'kickstarts' : {'dump' :
[self.dumper.dump_kickstart_data,
self.dumper.dump_kickstart_files]},
- 'rpms' : {'dump' :
self.dumper.dump_rpms},
+ 'rpms' : {'dump' :
self.dumper.dump_rpms},
}
else:
print "The output directory is not a directory"
commit ac43cb8e4e7dc032f523a2022b88212a11599f76
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 15:56:05 2012 +0200
fixed Bad indentation. Found 19 spaces, expected 20
diff --git a/backend/satellite_tools/disk_dumper/iss.py
b/backend/satellite_tools/disk_dumper/iss.py
index 9cb6593..1cbc933 100644
--- a/backend/satellite_tools/disk_dumper/iss.py
+++ b/backend/satellite_tools/disk_dumper/iss.py
@@ -417,15 +417,15 @@ class Dumper(dumper.XML_Dumper):
)
"""
elif self.use_rhn_date:
- query += """
- where ps.last_modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
+ query += """
+ where ps.last_modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
and ps.last_modified <= TO_TIMESTAMP(:end_date,
'YYYYMMDDHH24MISS')
- """
+ """
else:
- query += """
- where ps.modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
+ query += """
+ where ps.modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
and ps.modified <= TO_TIMESTAMP(:end_date,
'YYYYMMDDHH24MISS')
- """
+ """
self.source_package_query = rhnSQL.Statement(query)
source_package_data = rhnSQL.prepare(self.source_package_query)
source_package_data.execute(**dates)
@@ -496,17 +496,17 @@ class Dumper(dumper.XML_Dumper):
"""
if self.start_date:
if self.use_rhn_date:
- query += """
- and kt.last_modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
- and kt.last_modified <= TO_TIMESTAMP(:end_date,
'YYYYMMDDHH24MISS')
- and kt.org_id is Null
- """
+ query += """
+ and kt.last_modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
+ and kt.last_modified <= TO_TIMESTAMP(:end_date,
'YYYYMMDDHH24MISS')
+ and kt.org_id is Null
+ """
else:
- query += """
- and kt.modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
- and kt.modified <= TO_TIMESTAMP(:end_date,
'YYYYMMDDHH24MISS')
- and kt.org_id is Null
- """
+ query += """
+ and kt.modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
+ and kt.modified <= TO_TIMESTAMP(:end_date,
'YYYYMMDDHH24MISS')
+ and kt.org_id is Null
+ """
self.kickstart_trees_query = rhnSQL.Statement(query)
kickstart_data = rhnSQL.prepare(self.kickstart_trees_query)
self.kickstart_trees = []
commit afab5851a494f2c3e2523936b34b4ab606462abd
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 15:52:45 2012 +0200
fixed Line too long (133/120)
Line too long (136/120)
Line too long (133/120)
Line too long (140/120)
Line too long (132/120)
Line too long (140/120)
Line too long (141/120)
Line too long (134/120)
Line too long (123/120)
Line too long (137/120)
Line too long (123/120)
Line too long (129/120)
Line too long (130/120)
Line too long (121/120)
Line too long (129/120)
Line too long (123/120)
Line too long (124/120)
Line too long (154/120)
Line too long (128/120)
Line too long (130/120)
Line too long (122/120)
Line too long (182/120)
Line too long (147/120)
Line too long (231/120)
Line too long (124/120)
diff --git a/backend/satellite_tools/disk_dumper/iss.py
b/backend/satellite_tools/disk_dumper/iss.py
index ffd4f71..9cb6593 100644
--- a/backend/satellite_tools/disk_dumper/iss.py
+++ b/backend/satellite_tools/disk_dumper/iss.py
@@ -238,7 +238,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught while getting channel info." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught while getting channel info." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
###BINARY RPM INFO###
try:
@@ -301,7 +303,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught while getting binary rpm info." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught while getting binary rpm info." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
###PACKAGE INFO###
#This will grab channel package information for a given channel.
@@ -375,7 +379,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught while getting package info." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught while getting package info." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
###SOURCE PACKAGE INFO###
try:
@@ -435,7 +441,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught while getting source package info." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught while getting source package info." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
###ERRATA INFO###
try:
@@ -474,7 +482,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught while getting errata info." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught while getting errata info." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
###KICKSTART DATA/TREES INFO###
try:
@@ -511,7 +521,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught while getting kickstart data info." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught while getting kickstart data info." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
###KICKSTART FILES INFO###
try:
@@ -553,7 +565,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught while getting kickstart files info." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught while getting kickstart files info." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
#The close method overrides the parent classes close method. This implementation
#closes the self.outstream, which is an addition defined in this subclass.
@@ -600,7 +614,8 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError(exceptmsg % e.__class__.__name__, tbout.getvalue()), None,
sys.exc_info()[2]
+ raise ISSError(exceptmsg % e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
def dump_arches(self):
self._dump_simple(self.fm.getArchesFile(), dumper.XML_Dumper.dump_arches,
@@ -669,7 +684,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught in dump_channels." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught in dump_channels." %
e.__class__.__name__,
+ tbout.getvalue()), \
+ None, sys.exc_info()[2]
def dump_channel_packages_short(self):
try:
@@ -682,7 +699,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught in dump_channel_packages_short." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught in dump_channel_packages_short." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
def dump_packages(self):
try:
@@ -711,7 +730,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught in dump_packages." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught in dump_packages." %
e.__class__.__name__,
+ tbout.getvalue()), \
+ None, sys.exc_info()[2]
def dump_packages_short(self):
try:
@@ -738,7 +759,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught in dump_packages_short." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught in dump_packages_short." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
def dump_source_packages(self):
try:
@@ -750,7 +773,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught in dump_source_packages." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught in dump_source_packages." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
def dump_errata(self):
try:
@@ -778,7 +803,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught in dump_errata." % e.__class__.__name__,
tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught in dump_errata." % e.__class__.__name__,
+ tbout.getvalue()), \
+ None, sys.exc_info()[2]
def dump_kickstart_data(self):
try:
@@ -804,7 +831,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught in dump_kickstart_data." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught in dump_kickstart_data." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
def dump_kickstart_files(self):
try:
@@ -849,7 +878,9 @@ class Dumper(dumper.XML_Dumper):
except IOError, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("Error: Error copying file: %s: %s" %
(path_to_files, e.__class__.__name__), tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("Error: Error copying file: %s: %s" %
(path_to_files,
+ e.__class__.__name__), tbout.getvalue()), \
+ None, sys.exc_info()[2]
log2email(5, "Kickstart File: %s" %
os.path.join(kickstart_file['base-path'],
kickstart_file['relative-path']))
@@ -863,7 +894,9 @@ class Dumper(dumper.XML_Dumper):
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught in dump_kickstart_files." %
e.__class__.__name__, tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught in dump_kickstart_files." %
+ e.__class__.__name__, tbout.getvalue()), \
+ None, sys.exc_info()[2]
#RPM and SRPM dumping code
def dump_rpms(self):
@@ -884,7 +917,8 @@ class Dumper(dumper.XML_Dumper):
dirs_to_rpm = os.path.split(path_to_rpm)[0]
if (not rpm['path']):
- raise ISSError("Error: Missing RPM under the satellite mount
point. (Package id: %s)" % rpm['id'], "")
+ raise ISSError("Error: Missing RPM under the satellite mount
point. (Package id: %s)" %
+ rpm['id'], "")
#get the path to the rpm from under the satellite's mountpoint
satellite_path = os.path.join(CFG.MOUNT_POINT, rpm['path'])
@@ -908,12 +942,17 @@ class Dumper(dumper.XML_Dumper):
except IOError, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("Error: Error copying file %s: %s" %
(os.path.join(CFG.MOUNT_POINT, rpm['path']), e.__class__.__name__),
tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("Error: Error copying file %s: %s" %
+ (os.path.join(CFG.MOUNT_POINT,
rpm['path']),
+ e.__class__.__name__), tbout.getvalue()), \
+ None, sys.exc_info()[2]
except OSError, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("Error: Could not make hard link %s: %s
(different filesystems?)" % (os.path.join(CFG.MOUNT_POINT, rpm['path']),
-e.__class__.__name__), tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("Error: Could not make hard link %s: %s
(different filesystems?)" %
+ (os.path.join(CFG.MOUNT_POINT,
rpm['path']),
+ e.__class__.__name__), tbout.getvalue()), \
+ None, sys.exc_info()[2]
log2email(5, "RPM: %s" % rpm['path'])
pb.addTo(1)
@@ -926,7 +965,9 @@ e.__class__.__name__), tbout.getvalue()), None, sys.exc_info()[2]
except Exception, e:
tbout = cStringIO.StringIO()
Traceback(mail=0, ostream=tbout, with_locals=1)
- raise ISSError("%s caught in dump_rpms." % e.__class__.__name__,
tbout.getvalue()), None, sys.exc_info()[2]
+ raise ISSError("%s caught in dump_rpms." % e.__class__.__name__,
+ tbout.getvalue()), \
+ None, sys.exc_info()[2]
def get_report():
body = dumpEMAIL_LOG()
commit 17e651b6e9f2f0219c1cade1f27253938b31acc0
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 15:37:28 2012 +0200
expanded tabs
fixing
Found indentation with tabs instead of spaces
diff --git a/backend/satellite_tools/disk_dumper/iss.py
b/backend/satellite_tools/disk_dumper/iss.py
index 656c5a0..ffd4f71 100644
--- a/backend/satellite_tools/disk_dumper/iss.py
+++ b/backend/satellite_tools/disk_dumper/iss.py
@@ -162,14 +162,14 @@ class Dumper(dumper.XML_Dumper):
self.pb_length = 20 #progress bar length
self.pb_complete = " - Done!" #string that's printed when
progress bar is done.
self.pb_char = "#" #the string used as each unit in the
progress bar.
- self.hardlinks = hardlinks
+ self.hardlinks = hardlinks
- self.start_date = start_date
- self.end_date = end_date
+ self.start_date = start_date
+ self.end_date = end_date
self.use_rhn_date = use_rhn_date
self.whole_errata = whole_errata
- if self.start_date:
+ if self.start_date:
dates = { 'start_date' : self.start_date,
'end_date' : self.end_date, }
else:
@@ -183,10 +183,10 @@ class Dumper(dumper.XML_Dumper):
try:
query = """
select ch.id channel_id, label,
- TO_CHAR(last_modified, 'YYYYMMDDHH24MISS') last_modified
- from rhnChannel ch
- where ch.label = :label
- """
+ TO_CHAR(last_modified, 'YYYYMMDDHH24MISS') last_modified
+ from rhnChannel ch
+ where ch.label = :label
+ """
self.channel_query = rhnSQL.Statement(query)
ch_data = rhnSQL.prepare(self.channel_query)
@@ -253,9 +253,9 @@ class Dumper(dumper.XML_Dumper):
else:
query = """
select rcp.package_id id, rp.path path
- from rhnChannelPackage rcp, rhnPackage rp
- where rcp.package_id = rp.id
- and rcp.channel_id = :channel_id
+ from rhnChannelPackage rcp, rhnPackage rp
+ where rcp.package_id = rp.id
+ and rcp.channel_id = :channel_id
"""
if self.start_date:
@@ -309,13 +309,13 @@ class Dumper(dumper.XML_Dumper):
if self.whole_errata and self.start_date:
query = """
select rp.id package_id,
- TO_CHAR(rp.last_modified, 'YYYYMMDDHH24MISS') last_modified
+ TO_CHAR(rp.last_modified, 'YYYYMMDDHH24MISS')
last_modified
from rhnChannelPackage rcp, rhnPackage rp
left join rhnErrataPackage rep on rp.id = rep.package_id
left join rhnErrata re on rep.errata_id = re.id
- where rcp.channel_id = :channel_id
- and rcp.package_id = rp.id
- """
+ where rcp.channel_id = :channel_id
+ and rcp.package_id = rp.id
+ """
else:
query = """
select rp.id package_id,
@@ -379,12 +379,12 @@ class Dumper(dumper.XML_Dumper):
###SOURCE PACKAGE INFO###
try:
- query = """
+ query = """
select ps.id package_id,
- TO_CHAR(ps.last_modified,'YYYYMMDDHH24MISS') last_modified,
+ TO_CHAR(ps.last_modified,'YYYYMMDDHH24MISS')
last_modified,
ps.source_rpm_id source_rpm_id
from rhnPackageSource ps
- """
+ """
if self.start_date:
if self.whole_errata:
query += """
@@ -412,13 +412,13 @@ class Dumper(dumper.XML_Dumper):
"""
elif self.use_rhn_date:
query += """
- where ps.last_modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
- and ps.last_modified <= TO_TIMESTAMP(:end_date,
'YYYYMMDDHH24MISS')
+ where ps.last_modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
+ and ps.last_modified <= TO_TIMESTAMP(:end_date,
'YYYYMMDDHH24MISS')
"""
else:
query += """
- where ps.modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
- and ps.modified <= TO_TIMESTAMP(:end_date, 'YYYYMMDDHH24MISS')
+ where ps.modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
+ and ps.modified <= TO_TIMESTAMP(:end_date,
'YYYYMMDDHH24MISS')
"""
self.source_package_query = rhnSQL.Statement(query)
source_package_data = rhnSQL.prepare(self.source_package_query)
@@ -441,12 +441,12 @@ class Dumper(dumper.XML_Dumper):
try:
query = """
select e.id errata_id,
- TO_CHAR(e.last_modified,'YYYYMMDDHH24MISS') last_modified,
- e.advisory_name "advisory-name"
- from rhnChannelErrata ce, rhnErrata e
- where ce.channel_id = :channel_id
- and ce.errata_id = e.id
- """
+ TO_CHAR(e.last_modified,'YYYYMMDDHH24MISS')
last_modified,
+ e.advisory_name "advisory-name"
+ from rhnChannelErrata ce, rhnErrata e
+ where ce.channel_id = :channel_id
+ and ce.errata_id = e.id
+ """
if self.start_date:
if self.use_rhn_date:
query += """
@@ -479,23 +479,23 @@ class Dumper(dumper.XML_Dumper):
###KICKSTART DATA/TREES INFO###
try:
query = """
- select kt.id kstree_id, kt.label kickstart_label,
- TO_CHAR(kt.last_modified, 'YYYYMMDDHH24MISS') last_modified
- from rhnKickstartableTree kt
- where kt.channel_id = :channel_id
- """
+ select kt.id kstree_id, kt.label kickstart_label,
+ TO_CHAR(kt.last_modified, 'YYYYMMDDHH24MISS')
last_modified
+ from rhnKickstartableTree kt
+ where kt.channel_id = :channel_id
+ """
if self.start_date:
if self.use_rhn_date:
query += """
- and kt.last_modified >= TO_TIMESTAMP(:start_date, 'YYYYMMDDHH24MISS')
- and kt.last_modified <= TO_TIMESTAMP(:end_date, 'YYYYMMDDHH24MISS')
- and kt.org_id is Null
+ and kt.last_modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
+ and kt.last_modified <= TO_TIMESTAMP(:end_date,
'YYYYMMDDHH24MISS')
+ and kt.org_id is Null
"""
else:
query += """
- and kt.modified >= TO_TIMESTAMP(:start_date, 'YYYYMMDDHH24MISS')
- and kt.modified <= TO_TIMESTAMP(:end_date, 'YYYYMMDDHH24MISS')
- and kt.org_id is Null
+ and kt.modified >= TO_TIMESTAMP(:start_date,
'YYYYMMDDHH24MISS')
+ and kt.modified <= TO_TIMESTAMP(:end_date,
'YYYYMMDDHH24MISS')
+ and kt.org_id is Null
"""
self.kickstart_trees_query = rhnSQL.Statement(query)
kickstart_data = rhnSQL.prepare(self.kickstart_trees_query)
@@ -516,19 +516,19 @@ class Dumper(dumper.XML_Dumper):
###KICKSTART FILES INFO###
try:
query = """
- select rktf.relative_filename "relative-path",
- c.checksum_type "checksum-type", c.checksum,
+ select rktf.relative_filename "relative-path",
+ c.checksum_type "checksum-type", c.checksum,
rktf.file_size "file-size",
- TO_CHAR(rktf.last_modified, 'YYYYMMDDHH24MISS')
"last-modified",
- rkt.base_path "base-path",
- rkt.label label,
- TO_CHAR(rkt.modified, 'YYYYMMDDHH24MISS') "modified"
- from rhnKSTreeFile rktf, rhnKickstartableTree rkt,
+ TO_CHAR(rktf.last_modified, 'YYYYMMDDHH24MISS')
"last-modified",
+ rkt.base_path "base-path",
+ rkt.label label,
+ TO_CHAR(rkt.modified, 'YYYYMMDDHH24MISS')
"modified"
+ from rhnKSTreeFile rktf, rhnKickstartableTree rkt,
rhnChecksumView c
- where rktf.kstree_id = :kstree_id
- and rkt.id = rktf.kstree_id
+ where rktf.kstree_id = :kstree_id
+ and rkt.id = rktf.kstree_id
and rktf.checksum_id = c.id
- """
+ """
if self.start_date:
if self.use_rhn_date:
query += """
@@ -839,10 +839,10 @@ class Dumper(dumper.XML_Dumper):
try:
if self.hardlinks:
#Make hardlinks
- try:
+ try:
os.link(path_to_files, path_to_export_file)
- except OSError:
- pass
+ except OSError:
+ pass
else:
#Copy file from satellite to export dir.
shutil.copyfile(path_to_files, path_to_export_file)
@@ -1177,7 +1177,7 @@ class ExporterMain:
else:
self.actionmap[action]['dump']()
- # Now Compress the dump data
+ # Now Compress the dump data
if action != 'rpms':
if action == 'arches-extra':
action = 'arches'
@@ -1199,24 +1199,24 @@ class ExporterMain:
compress_file(filepath)
if self.options.make_isos:
#iso_output = os.path.join(self.isos_dir, self.dump_dir)
- iso_output = self.isos_dir
- if not os.path.exists(iso_output):
- os.makedirs(iso_output)
-
- iss_isos.create_isos(self.outputdir, iso_output, \
+ iso_output = self.isos_dir
+ if not os.path.exists(iso_output):
+ os.makedirs(iso_output)
+
+ iss_isos.create_isos(self.outputdir, iso_output, \
"rhn-export", self.start_date, self.end_date,
- iso_type=self.options.make_isos)
+ iso_type=self.options.make_isos)
# Generate md5sum digest file for isos
- if os.path.exists(iso_output):
- f = open(os.path.join(iso_output, 'MD5SUM'), 'w')
- for file in os.listdir(iso_output):
- if self.options.make_isos != "dvds":
- if file != "MD5SUM":
- md5_val = getFileChecksum('md5', (os.path.join(iso_output,
file)))
- md5str = "%s %s\n" % (md5_val, file)
- f.write(md5str)
- f.close()
+ if os.path.exists(iso_output):
+ f = open(os.path.join(iso_output, 'MD5SUM'), 'w')
+ for file in os.listdir(iso_output):
+ if self.options.make_isos != "dvds":
+ if file != "MD5SUM":
+ md5_val = getFileChecksum('md5',
(os.path.join(iso_output, file)))
+ md5str = "%s %s\n" % (md5_val, file)
+ f.write(md5str)
+ f.close()
if self.options.email:
sendMail()
commit 1efb2851d259e45662ecffb5f3a363ad4d3d2862
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Aug 24 15:31:28 2012 +0200
fixed :ProgressBar.__init__: Black listed name "bar"
diff --git a/backend/satellite_tools/progress_bar.py
b/backend/satellite_tools/progress_bar.py
index 1904c6d..9588bde 100644
--- a/backend/satellite_tools/progress_bar.py
+++ b/backend/satellite_tools/progress_bar.py
@@ -21,7 +21,7 @@ class ProgressBar:
def __init__(self, prompt='working: ', endTag=' - done',
finalSize=100.0, finalBarLength=10,
- bar='#', stream=sys.stdout, redrawYN=1):
+ barChar='#', stream=sys.stdout, redrawYN=1):
# disabling redrawing of the hash marks. Too many people are
# complaining.
@@ -34,7 +34,7 @@ class ProgressBar:
self.endTag = endTag
self.finalSize = float(finalSize)
self.finalBarLength = int(finalBarLength)
- self.bar = bar
+ self.barChar = barChar
self.stream = stream
self.redrawYN = redrawYN
if self.stream not in [sys.stdout, sys.stderr]:
@@ -53,7 +53,7 @@ class ProgressBar:
"""
if contextYN:
self.stream.write('%s%s\n' % (' '*len(self.prompt),
'_'*self.finalBarLength))
- toPrint = self.prompt + self.bar*self.barLength
+ toPrint = self.prompt + self.barChar*self.barLength
if self.redrawYN:
#self.stream.write('\b'*len(toPrint))
# backup
@@ -72,7 +72,7 @@ class ProgressBar:
if self.redrawYN:
self.printAll(contextYN=0)
else:
- self.stream.write(self.bar * (self.barLength - self.barLengthPrinted))
+ self.stream.write(self.barChar * (self.barLength - self.barLengthPrinted))
self.stream.flush()
self.barLengthPrinted = self.barLength