Implémentation d'un gestionnaire d'événements sommaire.

This commit is contained in:
Pierre-Elliott Bécue 2015-03-10 16:41:15 +01:00
parent 6c97d6998f
commit 201377528c
12 changed files with 411 additions and 239 deletions

View file

@ -16,13 +16,14 @@ import lc_ldap.attributs
from gestion.trigger.host import record_parser
@record_parser(lc_ldap.attributs.macAddress.ldap_name, lc_ldap.attributs.ipHostNumber.ldap_name)
def send_mac_ip(body, diff):
def send_mac_ip(ob_id, body, diff):
"""Computes mac_ip data to send from body and diff
"""
macs = tuple([body[i].get(lc_ldap.attributs.macAddress.ldap_name, [''])[0] for i in xrange(1, 3)])
ips = tuple([body[i].get(lc_ldap.attributs.ipHostNumber.ldap_name, [''])[0] for i in xrange(1, 3)])
hostnames = tuple([body[i].get(lc_ldap.attributs.host.ldap_name, [''])[0] for i in xrange(1, 3)])
The dict contains lists of tuples, so we can iterate on them
in the service."""
macs = tuple([body[i].get(lc_ldap.attributs.macAddress.ldap_name, [''])[0] for i in xrange(0, 2)])
ips = tuple([body[i].get(lc_ldap.attributs.ipHostNumber.ldap_name, [''])[0] for i in xrange(0, 2)])
hostnames = tuple([body[i].get(lc_ldap.attributs.host.ldap_name, [''])[0] for i in xrange(0, 2)])
# Régénération du DHCP :
if not macs[0]: