Merge "Delete HTTP tokens on `Sushy` shutdown"
This commit is contained in:
commit
817e77a115
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Tries to terminate authenticated Redfish session at BMC Session Service on
|
||||
the event of ``Sushy`` object deallocation. This should reduce the chance
|
||||
of authenticated sessions pool exhaustion at some BMCs.
|
|
@ -110,10 +110,21 @@ class Sushy(base.ResourceBase):
|
|||
super(Sushy, self).__init__(
|
||||
connector or sushy_connector.Connector(base_url, verify=verify),
|
||||
path=self._root_prefix)
|
||||
self._base_url = base_url
|
||||
self._auth = auth
|
||||
self._auth.set_context(self, self._conn)
|
||||
self._auth.authenticate()
|
||||
|
||||
def __del__(self):
|
||||
if self._auth:
|
||||
try:
|
||||
self._auth.close()
|
||||
|
||||
except Exception as ex:
|
||||
LOG.warning('Ignoring error while closing Redfish session '
|
||||
'with %s: %s', self._base_url, ex)
|
||||
self._auth = None
|
||||
|
||||
def _parse_attributes(self):
|
||||
super(Sushy, self)._parse_attributes()
|
||||
self.redfish_version = self.json.get('RedfishVersion')
|
||||
|
|
Loading…
Reference in New Issue