py3: fix swift-account-audit

Previously, we'd get a KeyError trying to read headers.

Change-Id: I5d9f86784a3e39577ab010d29d8d03b26ffda357
This commit is contained in:
Tim Burke 2019-10-14 11:15:14 -07:00
parent 29d46ca9f6
commit 2f4fe56ca4

View File

@ -177,7 +177,8 @@ class Auditor(object):
(path, node['ip'], node['device'])) (path, node['ip'], node['device']))
break break
if node['id'] not in responses: if node['id'] not in responses:
responses[node['id']] = dict(resp.getheaders()) responses[node['id']] = {
h.lower(): v for h, v in resp.getheaders()}
results = json.loads(resp.read()) results = json.loads(resp.read())
except Exception: except Exception:
self.container_exceptions += 1 self.container_exceptions += 1
@ -262,7 +263,8 @@ class Auditor(object):
(account, node['ip'], node['device'])) (account, node['ip'], node['device']))
break break
if node_id not in responses: if node_id not in responses:
responses[node_id] = [dict(resp.getheaders()), []] responses[node_id] = [
{h.lower(): v for h, v in resp.getheaders()}, []]
responses[node_id][1].extend(results) responses[node_id][1].extend(results)
if results: if results:
marker = results[-1]['name'] marker = results[-1]['name']