client/tools/rhnpush/connection.py | 57 ++++++++++++++--------------
client/tools/rhnpush/rhnpush.spec | 6 ++
client/tools/rhnpush/rhnpush_config.py | 6 +-
client/tools/rhnpush/rhnpush_confmanager.py | 13 ------
rel-eng/packages/rhnpush | 2
5 files changed, 38 insertions(+), 46 deletions(-)
New commits:
commit 253c09fde2e534401bc1bcebd8fe12399b3250f2
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Aug 21 18:17:01 2012 +0200
Automatic commit of package [rhnpush] release [5.5.51-1].
diff --git a/client/tools/rhnpush/rhnpush.spec b/client/tools/rhnpush/rhnpush.spec
index 67c02e0..a89b143 100644
--- a/client/tools/rhnpush/rhnpush.spec
+++ b/client/tools/rhnpush/rhnpush.spec
@@ -4,7 +4,7 @@ Name: rhnpush
Group: Applications/System
License: GPLv2
URL:
http://fedorahosted.org/spacewalk
-Version: 5.5.50
+Version: 5.5.51
Release: 1%{?dist}
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -63,6 +63,10 @@ rm -rf $RPM_BUILD_ROOT
%doc COPYING
%changelog
+* Tue Aug 21 2012 Michael Mraka <michael.mraka(a)redhat.com> 5.5.51-1
+- removed dead code
+- fixed pylint errors
+
* Wed Jul 25 2012 Michael Mraka <michael.mraka(a)redhat.com> 5.5.50-1
- fixed pylint warnings and errors
diff --git a/rel-eng/packages/rhnpush b/rel-eng/packages/rhnpush
index 3127ab3..dc30227 100644
--- a/rel-eng/packages/rhnpush
+++ b/rel-eng/packages/rhnpush
@@ -1 +1 @@
-5.5.50-1 client/tools/rhnpush/
+5.5.51-1 client/tools/rhnpush/
commit 81bac2f130eae2cd4e4177a0b3c5c39854766d8d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Aug 21 14:23:13 2012 +0200
removed dead ConfManager._write_config_file()
moreover it fixed ConfManager._write_config_file: Method could be a function
diff --git a/client/tools/rhnpush/rhnpush_confmanager.py
b/client/tools/rhnpush/rhnpush_confmanager.py
index a97dbc9..2324981 100644
--- a/client/tools/rhnpush/rhnpush_confmanager.py
+++ b/client/tools/rhnpush/rhnpush_confmanager.py
@@ -35,19 +35,6 @@ class ConfManager:
self.cmdconfig = optionparser
self.store_true_list = store_true_list
- #1/3/06 wregglej 172376 rhnpush shouldn't gag, choke, and die when trying to
write the
- #local config file on a read-only filesystem. Plus, I redid the writing of the config
files
- #to avoid duping code.
- #2/20/06 wregglej, but apparently it didn't occur to me to remove a completely
redundant try-catch.
- def _write_config_file(self, cfg_filename, config_obj):
- #Just skip writing the config file if access is denied. rhnpush is probably being
run
- #on a read-only filesystem, which is supported.
- cfg_dir = os.path.split(cfg_filename)[0]
- if os.access(cfg_dir, os.W_OK):
- new_config_file = open(cfg_filename, "w+")
- config_obj.write(new_config_file)
- new_config_file.close()
-
#Change the files options of the self.userconfig
#Change the exclude options of the self.userconfig
def _files_to_list(self):
commit 52f7d75d3cbf69366ef9e48d08d090e1aab6056a
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Aug 21 14:17:05 2012 +0200
fixed rhnpushConfigParser.__getitem__: Instance of 'ConfigParser' has no
'get_option' member
diff --git a/client/tools/rhnpush/rhnpush_config.py
b/client/tools/rhnpush/rhnpush_config.py
index 3034e46..324b52c 100644
--- a/client/tools/rhnpush/rhnpush_config.py
+++ b/client/tools/rhnpush/rhnpush_config.py
@@ -116,7 +116,7 @@ class rhnpushConfigParser:
#Returns an option read in from the configuration files.
def __getitem__(self, item):
- return self.settings.get_option(item)
+ return self.get_option(item)
#Takes all of the configuration options read in by the ConfigParser and makes them
attributes of the object.
def _add_config_as_attr(self, ensure_consistency=False):
commit 1d034b50ebb949e68a59b4295c996a4141beccfb
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Aug 21 14:13:14 2012 +0200
fixed Too many arguments for format string
diff --git a/client/tools/rhnpush/rhnpush_config.py
b/client/tools/rhnpush/rhnpush_config.py
index 93e8dd8..3034e46 100644
--- a/client/tools/rhnpush/rhnpush_config.py
+++ b/client/tools/rhnpush/rhnpush_config.py
@@ -82,14 +82,14 @@ class rhnpushConfigParser:
try:
self.settings.read([self.filename])
except IOError, e:
- print "Config File Error: line %s, file %s: $s" % (e.lineno,
e.filename, e)
+ print "Config File Error: line %s, file %s: %s" % (e.lineno,
e.filename, e)
sys.exit(1)
def write(self, fileobj):
try:
self.settings.write(fileobj)
except IOError, e:
- print "Config File Error: line %s, file %s: $s" % (e.lineno,
e.filename, e)
+ print "Config File Error: line %s, file %s: %s" % (e.lineno,
e.filename, e)
sys.exit(1)
commit 139486f1d51e0fb09bed98933aa545031166d6e5
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Aug 21 14:11:44 2012 +0200
fixed PackageUpload.get_error_message: Unused variable 'errcodestr'
diff --git a/client/tools/rhnpush/connection.py b/client/tools/rhnpush/connection.py
index e69cde4..b82e4c3 100644
--- a/client/tools/rhnpush/connection.py
+++ b/client/tools/rhnpush/connection.py
@@ -255,7 +255,6 @@ class PackageUpload:
def get_error_message(self, headers):
prefix = self.header_prefix + '-Error'
- errcodestr = prefix + "-Code"
text = map(lambda x: x[1], headers.getaddrlist(prefix + '-String'))
# text is a list now, convert it to a string
text = '\n'.join(text)
commit cdda6393da4332f68bb7363200dd444705c3bd13
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Aug 21 14:11:05 2012 +0200
locally disabled BaseConnection: Too many instance attributes (10/7) PackageUpload:
Too many instance attributes (13/7)
diff --git a/client/tools/rhnpush/connection.py b/client/tools/rhnpush/connection.py
index 8657343..e69cde4 100644
--- a/client/tools/rhnpush/connection.py
+++ b/client/tools/rhnpush/connection.py
@@ -28,7 +28,7 @@ from spacewalk.common.rhn_pkg import InvalidPackageError,
package_from_filename
class ConnectionError(Exception):
pass
-
+# pylint: disable=R0902
class BaseConnection:
def __init__(self, uri, proxy=None):
self._scheme, (self._host, self._port), self._path = parse_url(uri)[:3]
commit 8a361df4303ca3e786045c045bf0cd92c6fa31f1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Aug 21 14:07:57 2012 +0200
fixed BaseConnection.parse_url: Method could be a function
diff --git a/client/tools/rhnpush/connection.py b/client/tools/rhnpush/connection.py
index 49fdc94..8657343 100644
--- a/client/tools/rhnpush/connection.py
+++ b/client/tools/rhnpush/connection.py
@@ -31,7 +31,7 @@ class ConnectionError(Exception):
class BaseConnection:
def __init__(self, uri, proxy=None):
- self._scheme, (self._host, self._port), self._path = self.parse_url(uri)[:3]
+ self._scheme, (self._host, self._port), self._path = parse_url(uri)[:3]
if proxy:
arr = rpclib.get_proxy_info(proxy)
@@ -81,24 +81,6 @@ class BaseConnection:
return getattr(self._connection, name)
- def parse_url(self, url, scheme="http", path='/'):
- _scheme, netloc, _path, params, query, fragment = urlparse.urlparse(url)
- if not netloc:
- # No scheme - trying to patch it up ourselves?
- url = scheme + "://" + url
- _scheme, netloc, _path, params, query, fragment = urlparse.urlparse(url)
-
- if not netloc:
- # XXX
- raise Exception()
-
- (host, port) = urllib.splitport(netloc)
-
- if not _path:
- _path = path
-
- return (_scheme, (host, port), _path, params, query, fragment)
-
class PackageUpload:
header_prefix = "X-RHN-Upload"
user_agent = "rhn-package-upload"
@@ -279,3 +261,21 @@ class PackageUpload:
text = '\n'.join(text)
text = base64.decodestring(text)
return text
+
+def parse_url(url, scheme="http", path='/'):
+ _scheme, netloc, _path, params, query, fragment = urlparse.urlparse(url)
+ if not netloc:
+ # No scheme - trying to patch it up ourselves?
+ url = scheme + "://" + url
+ _scheme, netloc, _path, params, query, fragment = urlparse.urlparse(url)
+
+ if not netloc:
+ # XXX
+ raise Exception()
+
+ (host, port) = urllib.splitport(netloc)
+
+ if not _path:
+ _path = path
+
+ return (_scheme, (host, port), _path, params, query, fragment)
commit 2c5c8d2dc3c8c10c9235d3a4a25050a5335ac1c6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Aug 21 13:59:34 2012 +0200
fixed PackageUpload.upload: Invalid name "FileChecksumType" (should match
[a-z_][a-zA-Z0-9_]{,30}$) PackageUpload.upload: Invalid name "FileChecksum"
(should match [a-z_][a-zA-Z0-9_]{,30}$)
diff --git a/client/tools/rhnpush/connection.py b/client/tools/rhnpush/connection.py
index 10742cf..49fdc94 100644
--- a/client/tools/rhnpush/connection.py
+++ b/client/tools/rhnpush/connection.py
@@ -175,7 +175,7 @@ class PackageUpload:
return self._response
- def upload(self, filename, FileChecksumType, FileChecksum):
+ def upload(self, filename, fileChecksumType, fileChecksum):
"""
Uploads a file.
Returns (http_error_code, error_message)
@@ -216,8 +216,8 @@ class PackageUpload:
self.nvra = nvra
# use the precomputed passed checksum
- self.checksum_type = FileChecksumType
- self.checksum = FileChecksum
+ self.checksum_type = fileChecksumType
+ self.checksum = fileChecksum
# Set headers
self.set_header("Content-Type", "application/x-rpm")
commit ccc5d0167528d75ca99fe8b4d94a97f9233cdfb8
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Aug 21 13:53:46 2012 +0200
fixed PackageUpload.upload: Attribute 'checksum' defined outside __init__
PackageUpload.upload: Attribute 'nvra' defined outside __init__
PackageUpload.send_http: Attribute '_resp_headers' defined outside __init__
PackageUpload.upload: Attribute 'packaging' defined outside __init__
PackageUpload.upload: Attribute 'checksum_type' defined outside __init__
PackageUpload.upload: Attribute '_response' defined outside __init__
diff --git a/client/tools/rhnpush/connection.py b/client/tools/rhnpush/connection.py
index 4e86840..10742cf 100644
--- a/client/tools/rhnpush/connection.py
+++ b/client/tools/rhnpush/connection.py
@@ -110,6 +110,12 @@ class PackageUpload:
self.package_version = None
self.package_release = None
self.package_arch = None
+ self.checksum = None
+ self.checksum_type = None
+ self.nvra = None
+ self._resp_headers = None
+ self.packaging = None
+ self._response = None
def set_header(self, name, value):
if not self.headers.has_key(name):
commit 0f9a93ea5d9cda98bf91382cc9193a2c26039795
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Aug 21 13:51:48 2012 +0200
fixed PackageUpload.get_error_message: Unused variable 'fault_code'
diff --git a/client/tools/rhnpush/connection.py b/client/tools/rhnpush/connection.py
index 449d303..4e86840 100644
--- a/client/tools/rhnpush/connection.py
+++ b/client/tools/rhnpush/connection.py
@@ -268,10 +268,6 @@ class PackageUpload:
def get_error_message(self, headers):
prefix = self.header_prefix + '-Error'
errcodestr = prefix + "-Code"
- if headers.has_key(errcodestr):
- fault_code = headers[errcodestr]
- else:
- fault_code = None
text = map(lambda x: x[1], headers.getaddrlist(prefix + '-String'))
# text is a list now, convert it to a string
text = '\n'.join(text)