Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
def dmi_warnings():
    if _dmi_not_available:
        return None

    if not hasattr(dmidecode, 'get_warnings'):
        return None

    return dmidecode.get_warnings()
Exemplo n.º 3
0
def dmi_warnings():
    if _dmi_not_available:
        return None

    if not hasattr(dmidecode, 'get_warnings'):
        return None

    return dmidecode.get_warnings()
Exemplo n.º 4
0
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()
Exemplo n.º 5
0
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()
Exemplo n.º 6
0
def dmi_warnings():
    if not hasattr(dmidecode, 'get_warnings'):
        return None

    return dmidecode.get_warnings()
Exemplo n.º 7
0
 def log_warnings(self):
     dmiwarnings = dmidecode.get_warnings()
     if dmiwarnings:
         log.warn(_("Error reading system DMI information: %s"), dmiwarnings)
         dmidecode.clear_warnings()
Exemplo n.º 8
0
            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)
Exemplo n.º 9
0
def dmi_warnings():
    if not hasattr(dmidecode, 'get_warnings'):
        return None

    return dmidecode.get_warnings()
Exemplo n.º 10
0
 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()
Exemplo n.º 11
0
def print_warnings():
    warn = dmidecode.get_warnings()
    if warn:
        print("### WARNING: %s" % warn)
        dmidecode.clear_warnings()
Exemplo n.º 12
0
                            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)
Exemplo n.º 13
0
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()