def collectData(): printDBG(1, "Collecting data from Satellite") s = Satellite(credentials['hostname']) s.setUsername(credentials['username']) s.setPassword(credentials['password']) h = s.listHosts() for host in h: printDBG(2, "Examining host " + host['name']) host['errata_reboot_suggested'] = False errata = s.getHostErrata(str(host['id'])) if len(errata) == 0: pass else: printDBG(3, "Host has applicable errata.") listOfHosts[host['name']] = host listOfHosts[host['name']]['errata'] = {} for erratum in errata: if erratum['reboot_suggested']: printDBG( 3, "Host will require reboot after errata application") host['errata_reboot_suggested'] = host[ 'errata_reboot_suggested'] or erratum['reboot_suggested'] erratumID = erratum['errata_id'] if erratumID in listOfErrata: pass else: listOfErrata[erratumID] = erratum listOfHosts[host['name']]['errata'][erratumID] = erratum
def collectData(): printDBG(1, "Collecting data from Satellite") s = Satellite(credentials['hostname']) s.setUsername(credentials['username']) s.setPassword(credentials['password']) hcs = s.listHostCollections() for hc in hcs: printDBG(2, "Examining host collection " + hc['name']) hcInfo = s.getHostCollection(hc['id']) hcInfo['errata'] = {} hcInfo['errataRebootSuggested'] = False for hcID in hcInfo['host_ids']: printDBG(3, "Examining collection member host") errata = s.getHostErrata(str(hcID)) for erratum in errata: hcInfo['errataRebootSuggested'] = hcInfo[ 'errataRebootSuggested'] or erratum['reboot_suggested'] erratumID = erratum['errata_id'] if erratumID not in listOfErrata.keys(): listOfErrata[erratumID] = erratum if erratumID not in hcInfo['errata'].keys(): hcInfo['errata'][erratumID] = erratum if hcInfo['name'] not in listOfHostCollections.keys(): listOfHostCollections[hcInfo['name']] = hcInfo