propagate volume through hub

This commit is contained in:
Tomas Kopecek 2017-03-20 13:29:54 +01:00
parent e6effec7e1
commit 8868d184cb
3 changed files with 8 additions and 5 deletions

View file

@ -8814,9 +8814,9 @@ class RootExports(object):
os.close(fd)
return True
def checkUpload(self, path, name, verify=None, tail=None):
def checkUpload(self, path, name, verify=None, tail=None, volume=None):
"""Return basic information about an uploaded file"""
fn = get_upload_path(path, name)
fn = get_upload_path(path, name, volume=volume)
data = {}
try:
fd = os.open(fn, os.O_RDONLY)
@ -12347,7 +12347,8 @@ def handle_upload(environ):
overwrite = args.get('overwrite', ('',))[0]
offset = args.get('offset', ('0',))[0]
offset = int(offset)
fn = get_upload_path(path, name, create=True)
volume = args.get('volume', ('DEFAULT',))[0]
fn = get_upload_path(path, name, create=True, volume=volume)
if os.path.exists(fn):
if not os.path.isfile(fn):
raise koji.GenericError("destination not a file: %s" % fn)

View file

@ -2521,6 +2521,8 @@ class ClientSession(object):
args['offset'] = str(offset)
if overwrite:
args['overwrite'] = "1"
if volume is not None:
args['volume'] = volume
size = len(chunk)
self.callnum += 1
handler = "%s?%s" % (self.baseurl, urllib.urlencode(args))
@ -2545,7 +2547,7 @@ class ClientSession(object):
# check if server supports fast upload
try:
self._callMethod('checkUpload', (path, name))
self._callMethod('checkUpload', (path, name), {'volume': volume})
# fast upload was introduced in 1.7.1, earlier servers will not
# recognise this call and return an error
except GenericError:

View file

@ -413,7 +413,7 @@ $value
<th>Output</th>
<td>
#for $volume, $filename in $output
<a href="$pathinfo.task($task.id, volume=$volume)/$urllib.quote($filename)">$filename</a><br/>
<a href="$pathinfo.task($task.id, volume=$volume)/$urllib.quote($filename)">$filename</a>
#if $filename.endswith('.log')
(<a href="getfile?taskID=$task.id&volume=$volume&name=$urllib.quote($filename)&offset=-4000">tail</a>)
#end if