Skip to content

Commit d90c369

Browse files
Patch fixes issue when login in BMC/eBMC is successful but response body has only Token
before FIx: Traceback (most recent call last): File "/home/shirisha_g/Desktop/Reinstall-202132021432/OPTEST-SETUP/op-test/common/OpTestUtil.py", line 2576, in login .format(r.status_code, json_data['status'], KeyError: 'status' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/shirisha_g/Desktop/Reinstall-202132021432/OPTEST-SETUP/op-test/OpTestConfiguration.py", line 939, in objs password=self.args.bmc_password) File "/home/shirisha_g/Desktop/Reinstall-202132021432/OPTEST-SETUP/op-test/common/OpTestEBMC.py", line 55, in __init__ r = self.conf.util_bmc_server.login() File "/home/shirisha_g/Desktop/Reinstall-202132021432/OPTEST-SETUP/op-test/common/OpTestUtil.py", line 2599, in login .format(self._url(uri), username, password, e)) common.Exceptions.HTTPCheck: Something happened with the HTTP Server. Review the following for more details Message="Requests post problem, check that your credentials are properly Signed-off-by: Praveen K Pandey <[email protected]>
1 parent e197972 commit d90c369

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

common/OpTestUtil.py

+6
Original file line numberDiff line numberDiff line change
@@ -2571,6 +2571,12 @@ def login(self, username=None, password=None):
25712571
self.xAuthHeader['X-Auth-Token'] = match.group(1)
25722572
self.jsonHeader.update(self.xAuthHeader)
25732573
json_data = json.loads(r.text)
2574+
if not (json_data.get('token') is None):
2575+
json_data={
2576+
"data": "User '%s' logged in" %username,
2577+
"message": "200 OK",
2578+
"status": "ok"
2579+
}
25742580
log.debug("r.status_code={} json_data['status']={}"
25752581
" r.text={} r.headers={} r.request.headers={}"
25762582
.format(r.status_code, json_data['status'],

0 commit comments

Comments
 (0)