예제 #1
0
 def run(self):
     if debug:
         time.sleep(5)
     try:
         self.hardware = smolt.Hardware()
         try:
             smolt.getPubUUID()
             self.emit(SIGNAL('smoltPageStatus(PyQt_PyObject)'), True)
         except:
             self.emit(SIGNAL('smoltPageStatus(PyQt_PyObject)'), False)
         self.emit(SIGNAL('profile_ready()'))
     except smolt.SystemBusError, e:
         self.error_message = e.msg
         self.emit(SIGNAL('system_bus_error()'))
예제 #2
0
def smolt_hardware_info():
    """ Get hardware information from smolt. """
    try:
        sys.path.append("/usr/share/smolt/client")
        import smolt
    except ImportError:
        return {'_error': 'smolt is not installed'}

    global _hardware
    if _hardware is None:
        _hardware = smolt.Hardware()

    return dict(
        (param, str(getattr(_hardware.host, param)))
        for param in dir(_hardware.host)
        if not param.startswith('_') and getattr(_hardware.host, param))
예제 #3
0
파일: hardware.py 프로젝트: scibian/func
class HardwareFacts(fact_module.BaseFactModule):
    """
    Will give some basic info abouut hardware things
    """
    version = "0.0.1"
    description = "A modules that supplies hardware facts"

    def __init__(self):
        super(HardwareFacts, self).__init__()
        try:
            sys.path.append("/usr/share/smolt/client")
            import smolt
        except ImportError, e:
            errmsg = "Import error while loading smolt for the hardware facts module. Smolt is probably not installed. This module is useless without it."
            self.logger.warning(errmsg)
            self.logger.warning("%s" % traceback.format_exc())
            # hmm, what to return...
            return

        hardware = smolt.Hardware()
        self.host = hardware.host
예제 #4
0
    for page in r['query']['pages']:
        try:
            if int(page) > 0:
                found.append('\t%swiki/%s' % (smoonURL, r['query']['pages'][page]['title']))
        except KeyError:
            pass

    if found:
        print _("\tErrata Found!")
        for f in found: print "\t%s" % f
    else:
        print _("\tNo errata found, if this machine is having issues please go to")
        print _("\tyour profile and create a wiki page for the device so others can")
        print _("\tbenefit")
      
if __name__ == "__main__":  
    # read the profile
    smoonURL = get_config_attr("SMOON_URL", "http://smolts.org/")
    ConnSetup(smoonURL)
    try:
        profile = smolt.Hardware()
    except smolt.SystemBusError, e:
        error(_('Error:') + ' ' + e.msg)
        if e.hint is not None:
            error('\t' + _('Hint:') + ' ' + e.hint)
        sys.exit(8)
    scan(profile, smoonURL)
    rating(profile, smoonURL)

예제 #5
0
 def gather_data(self):
     self.hardware = smolt.Hardware()