mirror of
https://opendev.org/x/pyghmi
synced 2025-01-15 04:07:48 +00:00
Add license check and install
Port the IPMI capabilities for license management for Lenovo XCC systems. Change-Id: Idd9b0e6131161fbafebf760922b5731e1d0e76f7
This commit is contained in:
parent
622d0dfca0
commit
92c1088cd1
@ -1260,6 +1260,13 @@ class Command(object):
|
||||
def get_diagnostic_data(self, savefile, progress=None):
|
||||
return self.oem.get_diagnostic_data(savefile, progress)
|
||||
|
||||
def get_licenses(self):
|
||||
return self.oem.get_licenses()
|
||||
|
||||
def apply_license(self, filename, progress=None):
|
||||
return self.oem.apply_license(filename, progress)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import os
|
||||
import sys
|
||||
|
@ -87,4 +87,10 @@ class OEMHandler(object):
|
||||
:return:
|
||||
"""
|
||||
raise exc.UnsupportedFunctionality(
|
||||
'Do not know how to get diagnostic data for this platform')
|
||||
'Do not know how to get diagnostic data for this platform')
|
||||
|
||||
def get_licenses(self):
|
||||
raise exc.UnsupportedFunctionality()
|
||||
|
||||
def apply_license(self, filename, progress=None):
|
||||
raise exc.UnsupportedFunctionality()
|
||||
|
@ -702,4 +702,21 @@ class OEMHandler(generic.OEMHandler):
|
||||
'progress': 100 * self.wc.get_download_progress()})
|
||||
self._refresh_token()
|
||||
if progress:
|
||||
progress({'phase': 'complete'})
|
||||
progress({'phase': 'complete'})
|
||||
|
||||
def get_licenses(self):
|
||||
licdata = self.wc.grab_json_response('/api/providers/imm_fod')
|
||||
for lic in licdata.get('items', [{}])[0].get('keys', []):
|
||||
if lic['status'] == 0:
|
||||
yield {'name': lic['feature']}
|
||||
|
||||
def apply_license(self, filename, progress=None):
|
||||
uploadthread = webclient.FileUploader(self.wc, '/upload', filename)
|
||||
uploadthread.start()
|
||||
uploadthread.join()
|
||||
rsp = json.loads(uploadthread.rsp)
|
||||
licpath = rsp.get('items', [{}])[0].get('path', None)
|
||||
if licpath:
|
||||
self.wc.grab_json_response('/api/providers/imm_fod',
|
||||
{'FOD_LicenseKeyInstall': licpath})
|
||||
return self.get_licenses()
|
||||
|
Loading…
x
Reference in New Issue
Block a user