avoid using encode_int in some of the client code

This commit is contained in:
Mike McLean 2017-06-23 11:43:41 -04:00
parent ab48fa80b2
commit 2865f2421b
4 changed files with 5 additions and 6 deletions

View file

@ -2693,7 +2693,7 @@ class ClientSession(object):
while True:
if debug:
self.logger.debug("uploadFile(%r,%r,%r,%r,%r,...)" %(path, name, sz, digest, offset))
if self.callMethod('uploadFile', path, name, encode_int(sz), digest, encode_int(offset), data, **volopts):
if self.callMethod('uploadFile', path, name, sz, digest, offset, data, **volopts):
break
if tries <= retries:
tries += 1

View file

@ -60,7 +60,7 @@ def incremental_upload(session, fname, fd, path, retries=5, logger=None):
tries = 0
while True:
if session.uploadFile(path, fname, koji.encode_int(size), digest, koji.encode_int(offset), data):
if session.uploadFile(path, fname, size, digest, offset, data):
break
if tries <= retries:

View file

@ -731,8 +731,8 @@ class VMExecTask(BaseTaskHandler):
"""
remotepath = os.path.dirname(os.path.join(self.getUploadDir(), filepath))
filename = os.path.basename(filepath)
self.session.uploadFile(remotepath, filename, koji.encode_int(size),
md5sum, koji.encode_int(offset), data)
self.session.uploadFile(remotepath, filename, size,
md5sum, offset, data)
def verifyChecksum(self, path, checksum, algo='sha1'):
local_path = os.path.abspath(os.path.join(self.output_dir, path))

View file

@ -774,14 +774,13 @@ def getfile(environ, taskID, name, volume='DEFAULT', offset=None, size=None):
def _chunk_file(server, environ, taskID, name, offset, size, volume):
remaining = size
encode_int = koji.encode_int
while True:
if remaining <= 0:
break
chunk_size = 1048576
if remaining < chunk_size:
chunk_size = remaining
content = server.downloadTaskOutput(taskID, name, offset=encode_int(offset), size=chunk_size, volume=volume)
content = server.downloadTaskOutput(taskID, name, offset=offset, size=chunk_size, volume=volume)
if not content:
break
yield content