mirror of
https://opendev.org/x/pyghmi
synced 2025-01-14 19:57:47 +00:00
Add support for XCC License key management
XCC features are managed in keys, support management of those keys. Change-Id: I10a1e55dd6705cebacb8c49c98f19491bdf9e2d0
This commit is contained in:
parent
534963553b
commit
cad67cf751
@ -1982,3 +1982,11 @@ class Command(object):
|
||||
"""
|
||||
self.oem_init()
|
||||
return self._oem.list_media()
|
||||
|
||||
def get_licenses(self):
|
||||
self.oem_init()
|
||||
return self._oem.get_licenses()
|
||||
|
||||
def apply_license(self, filename, progress=None):
|
||||
self.oem_init()
|
||||
return self._oem.apply_license(filename, progress)
|
||||
|
@ -348,3 +348,9 @@ class OEMHandler(object):
|
||||
Takes a key value pair and applies it against the system configuration
|
||||
"""
|
||||
raise exc.UnsupportedFunctionality()
|
||||
|
||||
def get_licenses(self):
|
||||
raise exc.UnsupportedFunctionality()
|
||||
|
||||
def apply_license(self, filename, progress=None):
|
||||
raise exc.UnsupportedFunctionality()
|
||||
|
@ -968,3 +968,13 @@ class OEMHandler(generic.OEMHandler):
|
||||
if self.has_xcc:
|
||||
return self.immhandler.get_health(summary)
|
||||
return super(OEMHandler, self).get_health(summary)
|
||||
|
||||
def get_licenses(self):
|
||||
if self.has_xcc:
|
||||
return self.immhandler.get_licenses()
|
||||
return super(OEMHandler, self).get_licenses()
|
||||
|
||||
def apply_license(self, filename, progress=None):
|
||||
if self.has_xcc:
|
||||
return self.immhandler.apply_license(filename, progress)
|
||||
return super(OEMHandler, self).apply_license(filename, progress)
|
||||
|
@ -1604,3 +1604,20 @@ class XCCClient(IMMClient):
|
||||
# The XCC reports healthy, no need to interrogate
|
||||
raise pygexc.BypassGenericBehavior()
|
||||
# Will use the generic handling for unhealthy systems
|
||||
|
||||
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