PR#1958: fix potentially undeclared variable error

Merges #1958
https://pagure.io/koji/pull-request/1958

Fixes: #1957
https://pagure.io/koji/issue/1957
unreferenced variable
This commit is contained in:
Tomas Kopecek 2020-02-18 11:54:15 +01:00
commit 73df118b03
2 changed files with 2 additions and 2 deletions

View file

@ -1676,8 +1676,8 @@ def openRemoteFile(relpath, topurl=None, topdir=None, tempdir=None):
if topurl:
url = "%s/%s" % (topurl, relpath)
fo = tempfile.TemporaryFile(dir=tempdir)
resp = requests.get(url, stream=True)
try:
resp = requests.get(url, stream=True)
for chunk in resp.iter_content(chunk_size=8192):
fo.write(chunk)
finally:

View file

@ -478,8 +478,8 @@ class BaseTaskHandler(object):
return fn
self.logger.debug("Downloading %s", relpath)
url = "%s/%s" % (self.options.topurl, relpath)
resp = requests.get(url, stream=True)
try:
resp = requests.get(url, stream=True)
if not os.path.exists(os.path.dirname(fn)):
os.makedirs(os.path.dirname(fn))
with open(fn, 'wb') as fdst: