Esempio n. 1
0
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
Esempio n. 2
0
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:
        hostItem = {}
        hostItem['name'] = host['name']
        hostItem['subs'] = []
        subItems = s.getHostSubscriptions(str(host['id']))
        if (type(None) == type(subItems)):
            continue
        for item in subItems:
            si = {}
            if ('name' not in item):
                continue
            if (item['name'] in ['EPEL', 'FPLInternal']):
                continue
            si['accountNum'] = item['account_number']
            si['contractNum'] = item['contract_number']
            si['endDate'] = item['end_date']
            si['name'] = item['name']
            hostItem['subs'].append(si)
        listOfHosts.append(hostItem)
Esempio n. 3
0
def collectData():
  printDBG(1, "Collecting data from Satellite")
  s = Satellite(credentials['hostname'])
  s.setUsername(credentials['username'])
  s.setPassword(credentials['password'])
  h=s.listHosts()
  for name in h:
    hostDetail = s.getHost(name['id'])
    pprint.pprint(hostDetail)
    sys.exit(0)
    if hostDetail['ip'] == None:
      continue
    if not hostObjects.has_key(hostDetail['name']):
      hostObjects[hostDetail['name']] = {}
    hostName = hostDetail['name']
    printDBG(2, "Processing host %s" % (hostName,))
    hostObjects[hostName]['ip'] = hostDetail['ip']
    if hostDetail.has_key('content_facet_attributes'):
      hostObjects[hostName]['lifecycleEnvironment'] = hostDetail['content_facet_attributes']['lifecycle_environment_name']
      hostObjects[hostName]['contentView'] = hostDetail['content_facet_attributes']['content_view_name']
      hostObjects[hostName]['secErrata'] = str(hostDetail['content_facet_attributes']['errata_counts']['security'])
      hostObjects[hostName]['bugErrata'] = str(hostDetail['content_facet_attributes']['errata_counts']['bugfix'])
      hostObjects[hostName]['enhErrata'] = str(hostDetail['content_facet_attributes']['errata_counts']['enhancement'])
      hostObjects[hostName]['pkgUpdates'] = str(hostDetail['content_facet_attributes']['upgradable_package_count'])
      hostObjects[hostName]['lastCheckin'] = str(hostDetail['content_facet_attributes']['lastCheckin'])
    else:
      hostObjects[hostName]['lifecycleEnvironment'] = 'NO DATA'
      hostObjects[hostName]['contentView'] = 'NO DATA'
      hostObjects[hostName]['secErrata'] = 'NO DATA'
      hostObjects[hostName]['bugErrata'] = 'NO DATA'
      hostObjects[hostName]['enhErrata'] = 'NO DATA'
      hostObjects[hostName]['pkgUpdates'] = 'NO DATA'
      hostObjects[hostName]['katelloAgent'] = 'NO DATA'
    
    if hostDetail.has_key('subscription_status_label'):
      hostObjects[hostName]['subStatus'] = hostDetail['subscription_status_label']
    else:
      hostObjects[hostName]['subStatus'] = 'NO DATA'