[trigger] Amélioration de lisibilité dans les logs, et correctif mineur
* Ordre des imports dans le service firewall foireux
This commit is contained in:
parent
ccaf431202
commit
56d73814db
4 changed files with 18 additions and 7 deletions
|
@ -6,6 +6,11 @@
|
|||
#
|
||||
# Author : Pierre-Elliott Bécue <becue@crans.org>
|
||||
# Licence : GPLv3
|
||||
# Date : 14/07/2014
|
||||
#
|
||||
# TODO : Take care of each XXX or TODO think about updating
|
||||
# gestion/config/dhcp when submitting for production, because
|
||||
# of .test files.
|
||||
|
||||
import socket
|
||||
import os
|
||||
|
@ -78,12 +83,18 @@ class Dhcp(BasicService):
|
|||
|
||||
if body and isinstance(body, dict):
|
||||
for (mac, ip, name) in body.get("add", []):
|
||||
cls.add_dhcp_host(mac, ip, name)
|
||||
logger.info("Updating DHCP db by adding %s, %s, %s", mac, ip, name)
|
||||
# XXX - Uncommend this when we need to start prod
|
||||
# cls.add_dhcp_host(mac, ip, name)
|
||||
for (mac, ip) in body.get("delete", []):
|
||||
cls.delete_dhcp_host(mac, ip)
|
||||
logger.info("Updating DHCP db by deleting %s, %s", mac, ip)
|
||||
# XXX - Uncommend this when we need to start prod
|
||||
# cls.delete_dhcp_host(mac, ip)
|
||||
for (rmac, rip, mac, ip, name) in body.get("update", []):
|
||||
cls.delete_dhcp_host(rmac, rip)
|
||||
cls.add_dhcp_host(mac, ip, name)
|
||||
logger.info("Updating DHCP db by modifying %s, %s to %s, %s, %s", rmac, rip, mac, ip, name)
|
||||
# XXX - Uncommend this when we need to start prod
|
||||
# cls.delete_dhcp_host(rmac, rip)
|
||||
# cls.add_dhcp_host(mac, ip, name)
|
||||
elif body == True:
|
||||
hosts = {}
|
||||
host_template = """
|
||||
|
|
|
@ -48,7 +48,7 @@ class EventProducer(cmb.BasicProducer):
|
|||
"""Extended
|
||||
|
||||
"""
|
||||
logger.info("Starting trigger EventProducer program…")
|
||||
logger.info("Starting trigger EventProducer program for app %s…", app_id)
|
||||
super(EventProducer, self).__init__(trigger_config.master, 'trigger', app_id)
|
||||
self._connection = self.connect()
|
||||
self.get_chan()
|
||||
|
|
|
@ -15,11 +15,11 @@ it to regenerate what needs to.
|
|||
"""
|
||||
|
||||
import cranslib.clogger as clogger
|
||||
import gestion.config.trigger as trigger_config
|
||||
logger = clogger.CLogger("trigger", "firewall", "debug", trigger_config.debug)
|
||||
|
||||
import lc_ldap.shortcuts
|
||||
|
||||
import gestion.config.trigger as trigger_config
|
||||
from gestion.trigger.services.service import BasicService
|
||||
import gestion.trigger.firewall4.firewall4 as firewall4
|
||||
|
||||
|
|
|
@ -61,9 +61,9 @@ class EvenementListener(cmb.AsynchronousConsumer):
|
|||
# Peut-être utile plus tard
|
||||
#origin = properties.app_id
|
||||
#message_id = properties.message_id
|
||||
body = cPickle.loads(body)
|
||||
logger.info('Received message # %s from %s: %s',
|
||||
basic_deliver.delivery_tag, properties.app_id, body)
|
||||
body = cPickle.loads(body)
|
||||
# On tente d'invoquer le trigger attendu, à l'aide de la méthode trigger
|
||||
# about contient le nom de la fonction à appeler, body lui est filé en argument.
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue