mirror of
https://opendev.org/x/pyghmi
synced 2026-06-15 08:10:46 +00:00
Merge "More enhancements for generic MegaRAC"
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
# limitations under the License.
|
||||
|
||||
import pyghmi.redfish.oem.generic as generic
|
||||
import pyghmi.util.webclient as webclient
|
||||
from urllib.parse import urlencode
|
||||
|
||||
|
||||
|
||||
class OEMHandler(generic.OEMHandler):
|
||||
@@ -28,3 +31,37 @@ class OEMHandler(generic.OEMHandler):
|
||||
sysurl = system['@odata.id']
|
||||
break
|
||||
self._varsysurl = sysurl
|
||||
self._wc = None
|
||||
self.bmc = webclient.thehost
|
||||
self._certverify = webclient._certverify
|
||||
|
||||
|
||||
@property
|
||||
def wc(self):
|
||||
self.fwid = None
|
||||
if self._wc:
|
||||
rsp, status = self._wc.grab_json_response_with_status(
|
||||
'/api/chassis-status')
|
||||
if status == 200:
|
||||
return self._wc
|
||||
authdata = {
|
||||
'username': self.username,
|
||||
'password': self.password,
|
||||
}
|
||||
wc = webclient.SecureHTTPConnection(self.bmc, 443,
|
||||
verifycallback=self._certverify,
|
||||
timeout=180)
|
||||
wc.set_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||
rsp, status = wc.grab_json_response_with_status(
|
||||
'/api/session', urlencode(authdata))
|
||||
|
||||
if status < 200 or status >= 300:
|
||||
raise Exception('Error establishing web session')
|
||||
print(repr(rsp))
|
||||
if 'CSRFToken' in rsp:
|
||||
self.csrftok = rsp['CSRFToken']
|
||||
wc.set_header('X-CSRFTOKEN', self.csrftok)
|
||||
self._wc = wc
|
||||
return wc
|
||||
|
||||
|
||||
|
||||
@@ -658,7 +658,7 @@ class OEMHandler(object):
|
||||
procfound = True
|
||||
summary['badreadings'].append(SensorReading(cinfo))
|
||||
if not procfound:
|
||||
procinfo = fishclient.sysinfo['ProcessorSummary']
|
||||
procinfo = fishclient.sysinfo.get('ProcessorSummary', {})
|
||||
procinfo['Name'] = 'Processors'
|
||||
summary['badreadings'].append(SensorReading(procinfo))
|
||||
memsumstatus = fishclient.sysinfo.get(
|
||||
|
||||
Reference in New Issue
Block a user