def log_warnings(self, dmidecode): dmiwarnings = dmidecode.get_warnings() if dmiwarnings: log.warn(_("Error reading system DMI information: %s"), dmiwarnings, exc_info=True) dmidecode.clear_warnings()
def dmi_warnings(): if _dmi_not_available: return None if not hasattr(dmidecode, 'get_warnings'): return None return dmidecode.get_warnings()
def ProcessWarnings(): if not hasattr(dmidecode, 'get_warnings'): return warnings = dmidecode.get_warnings() if warnings == None: return for warnline in warnings.split('\n'): # Ignore these warnings, as they are "valid" if not running as root if warnline == '/dev/mem: Permission denied': continue if warnline == 'No SMBIOS nor DMI entry point found, sorry.': continue # All other warnings will be printed if len(warnline) > 0: print "** DMI WARNING ** %s" % warnline dmidecode.clear_warnings()
def dmi_warnings(): if not hasattr(dmidecode, 'get_warnings'): return None return dmidecode.get_warnings()
def log_warnings(self): dmiwarnings = dmidecode.get_warnings() if dmiwarnings: log.warn(_("Error reading system DMI information: %s"), dmiwarnings) dmidecode.clear_warnings()
self.getUnameInfo, self.getReleaseInfo, self.getMemInfo, self.getCpuInfo, self.getLsCpuInfo, self.getNetworkInfo, self.getNetworkInterfaces, self.getVirtInfo, self.getPlatformSpecificInfo ] # try each hardware method, and try/except around, since # these tend to be fragile for hardware_method in hardware_methods: try: hardware_method() except Exception, e: log.warn("Hardware detection failed: %s" % e) #we need to know the DMI info and VirtInfo before determining UUID. #Thus, we can't figure it out within the main data collection loop. if self.allhw['virt.is_guest']: self._getVirtUUID() import dmidecode dmiwarnings = dmidecode.get_warnings() if dmiwarnings: log.warn(_("Error reading system DMI information: %s"), dmiwarnings) dmidecode.clear_warnings() return self.allhw if __name__ == '__main__': for hkey, hvalue in Hardware().getAll().items(): print "'%s' : '%s'" % (hkey, hvalue)
def log_warnings(self, dmidecode): dmiwarnings = dmidecode.get_warnings() if dmiwarnings: log.warning(f"Warnings while reading system DMI information:\n{dmiwarnings}") dmidecode.clear_warnings()
def print_warnings(): warn = dmidecode.get_warnings() if warn: print("### WARNING: %s" % warn) dmidecode.clear_warnings()
self.getCpuInfo, self.getLsCpuInfo, self.getNetworkInfo, self.getNetworkInterfaces, self.getVirtInfo, self.getPlatformSpecificInfo] # try each hardware method, and try/except around, since # these tend to be fragile for hardware_method in hardware_methods: try: hardware_method() except Exception, e: log.warn("Hardware detection failed: %s" % e) #we need to know the DMI info and VirtInfo before determining UUID. #Thus, we can't figure it out within the main data collection loop. if self.allhw['virt.is_guest']: self._getVirtUUID() import dmidecode dmiwarnings = dmidecode.get_warnings() if dmiwarnings: log.warn(_("Error reading system DMI information: %s"), dmiwarnings) dmidecode.clear_warnings() return self.allhw if __name__ == '__main__': for hkey, hvalue in Hardware().getAll().items(): print "'%s' : '%s'" % (hkey, hvalue)
def print_warnings(): "Simple function, dumping out warnings with a prefix if warnings are found and clearing warning buffer" warn = dmidecode.get_warnings() if warn: print("### WARNING: %s" % warn) dmidecode.clear_warnings()