def __init__(self): with open(os.path.dirname(__file__) + "/logging.conf", 'r') as f: config_dict = yaml.load(f, yaml.SafeLoader) logging.config.dictConfig(config_dict) if not os.path.exists(os.path.dirname(EEPROM_SYMLINK)): try: os.makedirs(os.path.dirname(EEPROM_SYMLINK)) except OSError as e: if e.errno != errno.EEXIST: raise open(EEPROM_SYMLINK, 'a').close() f = open(EEPROM_STATUS, 'w') f.write("initializing..") f.close() self.eeprom_path = EEPROM_SYMLINK super(Eeprom, self).__init__(self.eeprom_path, 0, EEPROM_STATUS, True) def sys_eeprom_get(client): return client.pltfm_mgr.pltfm_mgr_sys_eeprom_get() try: self.eeprom = thrift_try(sys_eeprom_get) except Exception: raise RuntimeError("eeprom.py: Initialization failed") self.eeprom_parse()
def get_bmc_version(): """ Retrieves the firmware version of the BMC Returns: A string containing the firmware version of the BMC """ ver = "N/A" def bmc_get(client): return client.pltfm_mgr.pltfm_mgr_chss_mgmt_bmc_ver_get() try: ver = thrift_try(bmc_get) except Exception: pass return ver
def __init__(self): file_create(_EEPROM_SYMLINK, '646') file_create(_EEPROM_STATUS, '646') with open(_EEPROM_STATUS, 'w') as f: f.write("initializing..") self.eeprom_path = _EEPROM_SYMLINK super(Eeprom, self).__init__(self.eeprom_path, 0, _EEPROM_STATUS, True) def sys_eeprom_get(client): return client.pltfm_mgr.pltfm_mgr_sys_eeprom_get() try: platform_eeprom = thrift_try(sys_eeprom_get) except Exception: raise RuntimeError("eeprom.py: Initialization failed") self.__eeprom_init(platform_eeprom)