Commit 8b5ff3ad authored by Łukasz Nowak's avatar Łukasz Nowak

Compatibility and specification.

Compat: Put key as first argument.

Spec: In case of passing key (and updating shadir) require urlmd5 too.
parent ac108329
...@@ -79,8 +79,8 @@ class NetworkcacheClient(object): ...@@ -79,8 +79,8 @@ class NetworkcacheClient(object):
elif value.startswith('http'): elif value.startswith('http'):
self.signature_certificate_url_list.append(value) self.signature_certificate_url_list.append(value)
def upload(self, file_descriptor, urlmd5=None, file_name=None, def upload(self, file_descriptor, key=None, urlmd5=None, file_name=None,
valid_until=None, architecture=None, key=None): valid_until=None, architecture=None):
''' Upload the file to the server. ''' Upload the file to the server.
If urlmd5 is None it must only upload to SHACACHE. If urlmd5 is None it must only upload to SHACACHE.
Otherwise, it must create a new entry on SHADIR. Otherwise, it must create a new entry on SHADIR.
...@@ -112,8 +112,9 @@ class NetworkcacheClient(object): ...@@ -112,8 +112,9 @@ class NetworkcacheClient(object):
(self.shacache_host, result.status, data)) (self.shacache_host, result.status, data))
if key is not None: if key is not None:
if file_name is None: if file_name is None or urlmd5 is None:
raise ValueError('In case if key is given file_name is required.') raise ValueError('In case if key is given file_name and urlmd5 '
'are required.')
kw = dict() kw = dict()
kw['file'] = file_name kw['file'] = file_name
kw['urlmd5'] = urlmd5 kw['urlmd5'] = urlmd5
......
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