Proyecto

General

Perfil

« Anterior | Siguiente » 

Revisión 335

Añadido por Manu Mora Gordillo hace casi 13 años

Equipos sin certificado. Equipos no registrados en LDAP

Ver diferencias:

scripts/nfs/puppetlastgroups
def puppetlast(times,search):
import pdb
global total_count
RED = '\033[91m'
RESET = '\033[0m'
for c in search:
if c[0]:
times_temp=[]
alumnos=c[1]
# Eliminar tuplas vias
alumnos=[x for x in c[1] if x]
curso=c[0]
without_cert=[]
if len(alumnos)>1:
for a in alumnos:
cert_exists=False
for t in times:
if (a in t[1]) and (a!=""):
if (a==t[1].split(".")[0]) and (a!=""):
times_temp.append (t)
cert_exists=True
if not cert_exists:
without_cert.append(a)
if len(times_temp)>1:
print "\n- "+curso+" ("+str(len(alumnos))+" elementos) ("+str(len(times_temp))+" certificados)"
if len(without_cert)>1:
for w in without_cert:
if w!="":
print RED, "Sin certificado: "+w, RESET
total_count=total_count+len(times_temp)
printtimes(times_temp)
def ldapSearch(baseDN,filter,retrieveAttributes):
try:
l = ldap.open("ldap")
......
# Equipos desconocidos
cmp=cmpLists(all_hosts, all_certs)
list=[]
for c in cmp["onlyInList2"]:
list.append(c.split(".")[0])
unknown=[]
unknown.append(("Desconocidos",cmp["onlyInList2"]))
unknown.append(("No registrados en LDAP (con certificado)",list))
puppetlast(t,unknown)
print "\nTotal certificados: "+str(total_count)

Exportar a: Unified diff