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()'))
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))
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
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)
def gather_data(self): self.hardware = smolt.Hardware()