Skip to content

Commit

Permalink
Merge pull request #48 from joelrebel/status_code_check
Browse files Browse the repository at this point in the history
Fix NoneType Attribute error if the connection fails due to a timeout.
  • Loading branch information
jautor authored Sep 5, 2019
2 parents c222f91 + 8b49276 commit df231c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion redfishMockupCreate.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,14 @@ def main(argv):
# verify we can talk to the rhost
rc, r, j, d = rft.getVersions(rft, cmdTop=True)
if(rc != 0):
if r:
status_code = r.status_code
else:
status_code = "unknown"

rft.printErr(
"ERROR: Cannot get Redfish service version from URI /redfish (status {}). Assuming default version."
.format(r.status_code))
.format(status_code))
rft.rootPath = urljoin("/redfish/", (rft.protocolVer + "/"))
d = {"v1": "/redfish/v1/"}
rf_version = json.dumps(d)
Expand Down

0 comments on commit df231c7

Please sign in to comment.