mirror of
https://opendev.org/x/pyghmi
synced 2026-04-02 00:03:30 +00:00
Amend incorrect logic in the redfish push
Somewhere in the back and forth the indentation was incorrect. Change-Id: I0556b6891c823e10ee399cc26f078050eed8a5b9
This commit is contained in:
@@ -751,43 +751,41 @@ class OEMHandler(generic.OEMHandler):
|
||||
progress(
|
||||
{'phase': 'upload',
|
||||
'progress': 100 * wc.get_upload_progress()})
|
||||
if (uploadthread.rspstatus >= 300
|
||||
or uploadthread.rspstatus < 200):
|
||||
rsp = uploadthread.rsp
|
||||
errmsg = ''
|
||||
try:
|
||||
rsp = json.loads(rsp)
|
||||
errmsg = (
|
||||
rsp['error'][
|
||||
'@Message.ExtendedInfo'][0]['Message'])
|
||||
except Exception:
|
||||
raise Exception(uploadthread.rsp)
|
||||
raise Exception(errmsg)
|
||||
rsp = json.loads(uploadthread.rsp)
|
||||
monitorurl = rsp['TaskMonitor']
|
||||
complete = False
|
||||
while not complete:
|
||||
pgress, status = self._do_web_request(monitorurl)
|
||||
if status < 200 or status >= 300:
|
||||
raise Exception(pgress)
|
||||
if not pgress:
|
||||
break
|
||||
for msg in pgress.get('Messages', []):
|
||||
if 'Verify failed' in msg.get('Message', ''):
|
||||
raise Exception(msg['Message'])
|
||||
state = pgress['TaskState']
|
||||
if state in ('Cancelled', 'Exception', 'Interrupted',
|
||||
'Suspended'):
|
||||
raise Exception(
|
||||
json.dumps(json.dumps(pgress['Messages'])))
|
||||
pct = float(pgress['PercentComplete'])
|
||||
complete = state == 'Completed'
|
||||
progress({'phase': 'apply', 'progress': pct})
|
||||
if not complete:
|
||||
time.sleep(3)
|
||||
if bank == 'backup':
|
||||
return 'complete'
|
||||
return 'pending'
|
||||
if (uploadthread.rspstatus >= 300
|
||||
or uploadthread.rspstatus < 200):
|
||||
rsp = uploadthread.rsp
|
||||
errmsg = ''
|
||||
try:
|
||||
rsp = json.loads(rsp)
|
||||
errmsg = (
|
||||
rsp['error'][
|
||||
'@Message.ExtendedInfo'][0]['Message'])
|
||||
except Exception:
|
||||
raise Exception(uploadthread.rsp)
|
||||
raise Exception(errmsg)
|
||||
rsp = json.loads(uploadthread.rsp)
|
||||
monitorurl = rsp['TaskMonitor']
|
||||
complete = False
|
||||
while not complete:
|
||||
pgress = self._do_web_request(monitorurl, cache=False)
|
||||
if not pgress:
|
||||
break
|
||||
for msg in pgress.get('Messages', []):
|
||||
if 'Verify failed' in msg.get('Message', ''):
|
||||
raise Exception(msg['Message'])
|
||||
state = pgress['TaskState']
|
||||
if state in ('Cancelled', 'Exception', 'Interrupted',
|
||||
'Suspended'):
|
||||
raise Exception(
|
||||
json.dumps(json.dumps(pgress['Messages'])))
|
||||
pct = float(pgress['PercentComplete'])
|
||||
complete = state == 'Completed'
|
||||
progress({'phase': 'apply', 'progress': pct})
|
||||
if not complete:
|
||||
time.sleep(3)
|
||||
if bank == 'backup':
|
||||
return 'complete'
|
||||
return 'pending'
|
||||
finally:
|
||||
self._do_web_request(
|
||||
'/redfish/v1/UpdateService',
|
||||
|
||||
Reference in New Issue
Block a user