Commit 0171f96c authored by Łukasz Nowak's avatar Łukasz Nowak

Selects requires urlmd5.

parent feb25cda
......@@ -153,13 +153,11 @@ class NetworkcacheClient(object):
file_descriptor.seek(0)
return file_descriptor
def select(self, directory_key=None):
def select(self, urlmd5):
''' Download a file from shacache by selecting the entry in shadir
Raise DirectoryNotFound if multiple files are found.
'''
path_info = self.shadir_path
if directory_key is not None:
path_info = os.path.join(self.shadir_path, directory_key)
path_info = os.path.join(self.shadir_path, urlmd5)
url = "http://%s:%s%s" % (self.shadir_host, self.shadir_port, path_info)
request = urllib2.Request(url=url, data=None,headers=self.shadir_header_dict)
......@@ -175,7 +173,7 @@ class NetworkcacheClient(object):
(self.signature_certificate_file_list or \
self.signature_certificate_url_list):
raise DirectoryNotFound('Too many entries for a given directory. ' \
'Directory: %s. Entries: %s.' % (directory_key, str(data_list)))
'Directory: %s. Entries: %s.' % (urlmd5, str(data_list)))
if self.signature_certificate_file_list or \
self.signature_certificate_url_list:
......@@ -183,7 +181,7 @@ class NetworkcacheClient(object):
data_list = filter(lambda x: method(x[1]), data_list)
if len(data_list) > 1:
raise DirectoryNotFound('Too many entries for a given key. ' \
'Directory: %s. Entries: %s.' %(directory_key, str(data_list)))
'Directory: %s. Entries: %s.' %(urlmd5, str(data_list)))
if not data_list:
raise DirectoryNotFound('Could not find a trustable entry.')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment