[global] Passage à tout unicode et quelques corrections mineures.

* Typos
 * Docstrings unicode
 * Erreurs unicode
 * Ajout de _post_delete et _post_create
 * ?
This commit is contained in:
Pierre-Elliott Bécue 2013-05-27 23:18:24 +02:00
parent b2abbef3b4
commit 60ded9f830
7 changed files with 244 additions and 237 deletions

View file

@ -8,6 +8,10 @@ import objets
import variables
import config
from gen_confs.dhcpd_new import dydhcp
import sys
if not '/usr/scripts' in sys.path:
sys.path.append('/usr/scripts')
import gestion.config as config
# liste des attributs dont dépend un service
services_to_attrs = {}
@ -211,20 +215,16 @@ def services_to_restart(conn, old_attrs={}, new_attrs={}):
# Cas du dhcp
if attr.__class__ in services_to_attrs['dhcp']:
if old_attrs.get('ipHostNumber', []) and old_attrs.get('macAddress', []):
if new_attrs.get('ipHostNumber', []) and new_attrs.get('macAddress', []):
if str(old_attrs['ipHostNumber'][0]) != str(new_attrs['ipHostNumber'][0]) or str(old_attrs['macAddress'][0]) != str(new_attrs['macAddress'][0]):
for server in config.dhcp_servers:
dhcp=dydhcp(server)
for server in config.dhcp_servers:
dhcp=dydhcp(server)
if old_attrs.get('ipHostNumber', []) and old_attrs.get('macAddress', []):
if new_attrs.get('ipHostNumber', []) and new_attrs.get('macAddress', []):
if str(old_attrs['ipHostNumber'][0]) != str(new_attrs['ipHostNumber'][0]) or str(old_attrs['macAddress'][0]) != str(new_attrs['macAddress'][0]):
dhcp.del_host(str(old_attrs['ipHostNumber'][0]), str(old_attrs['macAddress'][0]))
dhcp.add_host(str(new_attrs['ipHostNumber'][0]), str(new_attrs['macAddress'][0]), str(new_attrs['host'][0]))
else:
for server in config.dhcp_servers:
dhcp=dydhcp(server)
else:
dhcp.del_host(str(old_attrs['ipHostNumber'][0]), str(old_attrs['macAddress'][0]))
elif new_attrs.get('ipHostNumber', []) and new_attrs.get('macAddress', []):
for server in config.dhcp_servers:
dhcp=dydhcp(server)
elif new_attrs.get('ipHostNumber', []) and new_attrs.get('macAddress', []):
dhcp.add_host(str(new_attrs['ipHostNumber'][0]), str(new_attrs['macAddress'][0]), str(new_attrs['host'][0]))
if service in services_to_time.keys():