From 1b9c823a4575ad93313ddfbca6f44a3da6f48bc2 Mon Sep 17 00:00:00 2001 From: Yogesh Ramachandra Date: Thu, 27 Aug 2020 10:04:34 -0500 Subject: [PATCH] node last reboot time Returns This property provides the last time System Inventory collection On Reboot(CSIOR) was performed. The value is represented as yyyymmddHHMMSS retriewing this value to get the updated factory reset value from ironic wsman bios interface Change-Id: I73ff5eb517528afe56b5cf45a74fa5d5519db186 story:2008058 task:40739 --- dracclient/client.py | 12 ++++++++++++ dracclient/resources/system.py | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/dracclient/client.py b/dracclient/client.py index 413276d..eee5b48 100644 --- a/dracclient/client.py +++ b/dracclient/client.py @@ -94,6 +94,18 @@ class DRACClient(object): """ return self._power_mgmt.get_power_state() + def get_last_system_inventory_time(self): + """Returns This property provides the last time System Inventory + Collection On Reboot(CSIOR) was performed. The value is represented + as yyyymmddHHMMSS. + :returns: value is represented as yyyymmddHHMMSS + :raises: WSManRequestFailure on request failures + :raises: WSManInvalidResponse when receiving invalid response + :raises: DRACOperationFailed on error reported back by the DRAC + interface + """ + return self._system_cfg.last_system_inventory_time() + def set_power_state(self, target_state): """Turns the server power on/off or do a reboot diff --git a/dracclient/resources/system.py b/dracclient/resources/system.py index 1069cc3..30e6820 100644 --- a/dracclient/resources/system.py +++ b/dracclient/resources/system.py @@ -58,6 +58,24 @@ class SystemConfiguration(object): result[attribute.instance_id] = attribute return result + def last_system_inventory_time(self): + """"This property provides the last time SystemInventory Collection + On Reboot(CSIOR)was performed. The value is rep/resented as yyyymmddHHMMSS. + + :returns: the time when the machine is last rebooted + :raises: WSManRequestFailure on request failures + :raises: WSManInvalidResponse when receiving invalid response + :raises: DRACOperationFailed on error reported back by the DRAC + interface + """ + + filter_query = ('select LastSystemInventoryTime from DCIM_SystemView') + doc = self.client.enumerate(uris.DCIM_SystemView, + filter_query=filter_query) + inventorytime = utils.find_xml(doc, 'LastSystemInventoryTime', + uris.DCIM_SystemView) + return inventorytime.text + class SystemAttribute(object): """Generic System attribute class"""