Skip to content

Commit

Permalink
pep8 N806 fixes (lowercase function variable names)
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Waugh <twaugh@redhat.com>
  • Loading branch information
twaugh committed Jul 10, 2017
1 parent 1d6efc7 commit 6e4bd3a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions osbs/build/pod_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def get_failure_reason(self):
exitCode (if known): numeric exit code
"""

REASON_KEY = 'reason'
CID_KEY = 'containerID'
EXIT_KEY = 'exitCode'
reason_key = 'reason'
cid_key = 'containerID'
exit_key = 'exitCode'

pod_status = self.json.get('status', {})
statuses = pod_status.get('containerStatuses', [])
Expand All @@ -76,21 +76,21 @@ def get_failure_reason(self):
exit_code = terminated['exitCode']
if exit_code != 0:
reason_dict = {
EXIT_KEY: exit_code,
exit_key: exit_code,
}

if 'containerID' in terminated:
reason_dict[CID_KEY] = terminated['containerID']
reason_dict[cid_key] = terminated['containerID']

for key in ['message', 'reason']:
try:
reason_dict[REASON_KEY] = terminated[key]
reason_dict[reason_key] = terminated[key]
break
except KeyError:
continue
else:
# Both 'message' and 'reason' are missing
reason_dict[REASON_KEY] = 'Exit code {code}'.format(
reason_dict[reason_key] = 'Exit code {code}'.format(
code=exit_code
)

Expand All @@ -102,8 +102,8 @@ def get_failure_reason(self):
# pod
for key in ['message', 'reason']:
try:
return {REASON_KEY: pod_status[key]}
return {reason_key: pod_status[key]}
except KeyError:
continue

return {REASON_KEY: pod_status['phase']}
return {reason_key: pod_status['phase']}

0 comments on commit 6e4bd3a

Please sign in to comment.