Esempio n. 1
0
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