openbmctool: Update 200 status check
The bmcweb REST server doesn't return a '200 OK'
in the response text like the old REST server did,
so just explicitly check the status_code variable.
Tested: Tested on both old and new REST servers
Change-Id: I0813248f05c874e18042ab37552c500ef0ec6112
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/thalerj/openbmctool.py b/thalerj/openbmctool.py
index 0c2167a..c097484 100755
--- a/thalerj/openbmctool.py
+++ b/thalerj/openbmctool.py
@@ -307,7 +307,7 @@
print(connectionErrHandler(jsonFormat, "Timeout", None))
if(jsonFormat==False):
- if('"message": "200 OK"' in r.text):
+ if r.status_code == 200:
print('User ' +username + ' has been logged out')
@@ -1419,7 +1419,7 @@
url = 'https://'+host+'/xyz/openbmc_project/dump/action/CreateDump'
try:
r = session.post(url, headers=jsonHeader, json = {"data": []}, verify=False, timeout=30)
- if('"message": "200 OK"' in r.text and not args.json):
+ if(r.status_code == 200 and not args.json):
return ('Dump successfully created')
else:
return ('Failed to create dump')