| |
@@ -94,7 +94,7 @@
|
| |
return super(StreamLookasideCache, self).remote_file_exists(
|
| |
_name, filename, hashstr)
|
| |
|
| |
- def upload(self, name, filename, hashstr, offline=False, **kwargs):
|
| |
+ def upload(self, name, filename, hashstr, offline=False):
|
| |
"""
|
| |
Uploads a file to lookaside cache.
|
| |
|
| |
@@ -178,14 +178,11 @@
|
| |
def __init__(self, hashtype, download_url, upload_url, name, branch):
|
| |
super(CLLookasideCache, self).__init__(
|
| |
hashtype, download_url, upload_url, name, branch)
|
| |
- self.log.info(" Centpkg: CLLookasideCache __init__")
|
| |
self.name = name
|
| |
self.branch = branch
|
| |
|
| |
def get_download_url(self, name, filename, hash, hashtype=None, **kwargs):
|
| |
- print(" Centpkg: CLLookasideCache get_download_url")
|
| |
self.download_path='%(name)s/%(branch)s/%(hash)s'
|
| |
- print(" Centpkg: CLLookasideCache get_download_url download_path: " + self.download_path)
|
| |
if "/" in name:
|
| |
real_name = name.split("/")[-1]
|
| |
else:
|
| |
@@ -207,32 +204,28 @@
|
| |
|
| |
It inherits most of its behavior from `pyrpkg.lookasideCGILookasideCache`.
|
| |
"""
|
| |
- def __init__(self, hashtype, download_url, upload_url, name, branch, structure='hash', client_cert=None, ca_cert=None):
|
| |
+ def __init__(self, hashtype, download_url, upload_url, name, branch, client_cert=None, ca_cert=None):
|
| |
super(SIGLookasideCache, self).__init__(
|
| |
hashtype, download_url, upload_url, client_cert=client_cert, ca_cert=ca_cert)
|
| |
|
| |
self.name = name
|
| |
self.branch = branch
|
| |
- self.structure = structure
|
| |
|
| |
def get_download_url(self, name, filename, hash, hashtype=None, **kwargs):
|
| |
- if self.structure == 'hash':
|
| |
- download_path = '%(name)s/%(branch)s/%(hash)s'
|
| |
- if "/" in name:
|
| |
- real_name = name.split("/")[-1]
|
| |
- else:
|
| |
- real_name = name
|
| |
- path_dict = {
|
| |
- 'name': real_name,
|
| |
- 'filename': filename,
|
| |
- 'branch': self.branch,
|
| |
- 'hash': hash,
|
| |
- 'hashtype': hashtype
|
| |
- }
|
| |
- path = download_path % path_dict
|
| |
- return os.path.join(self.download_url, path)
|
| |
-
|
| |
- return super(SIGLookasideCache, self).get_download_url(name, filename, hash, hashtype, **kwargs)
|
| |
+ download_path = '%(name)s/%(branch)s/%(hash)s'
|
| |
+ if "/" in name:
|
| |
+ real_name = name.split("/")[-1]
|
| |
+ else:
|
| |
+ real_name = name
|
| |
+ path_dict = {
|
| |
+ 'name': real_name,
|
| |
+ 'filename': filename,
|
| |
+ 'branch': self.branch,
|
| |
+ 'hash': hash,
|
| |
+ 'hashtype': hashtype
|
| |
+ }
|
| |
+ path = download_path % path_dict
|
| |
+ return os.path.join(self.download_url, path)
|
| |
|
| |
def remote_file_exists(self, name, filename, hash):
|
| |
"""Verify whether a file exists on the lookaside cache
|
| |
@@ -259,8 +252,6 @@
|
| |
post_data = [('name', _name),
|
| |
('%ssum' % self.hashtype, hash),
|
| |
('filename', filename)]
|
| |
- if self.structure == 'branch':
|
| |
- post_data.append(('branch', self.branch))
|
| |
|
| |
with io.BytesIO() as buf:
|
| |
c = pycurl.Curl()
|
| |
@@ -338,8 +329,6 @@
|
| |
post_data = [('name', name),
|
| |
('%ssum' % self.hashtype, hash),
|
| |
('file', (pycurl.FORM_FILE, filepath))]
|
| |
- if self.structure == 'branch':
|
| |
- post_data.append(('branch', self.branch))
|
| |
|
| |
with io.BytesIO() as buf:
|
| |
c = pycurl.Curl()
|
| |
One of the past commits broke centpkg on RHEL 7 based systems, that use python2.
This commit fixes centpkg on RHEL 7 systems, as well as clean up some of the other code.
Signed-off-by: Troy Dawson tdawson@redhat.com