[services] Modifs de dydhcp, cf usr-scripts:9a5294c7ee60c1e9d439f1903a1dcda5b5322d41
This commit is contained in:
parent
8f4a7df242
commit
db9bf4540f
1 changed files with 11 additions and 5 deletions
|
@ -6,6 +6,7 @@ import lc_ldap
|
||||||
import attributs
|
import attributs
|
||||||
import objets
|
import objets
|
||||||
import variables
|
import variables
|
||||||
|
import config
|
||||||
from gen_confs.dhcpd_new import dydhcp
|
from gen_confs.dhcpd_new import dydhcp
|
||||||
|
|
||||||
# liste des attributs dont dépend un service
|
# liste des attributs dont dépend un service
|
||||||
|
@ -210,15 +211,20 @@ def services_to_restart(conn, old_attrs={}, new_attrs={}):
|
||||||
|
|
||||||
# Cas du dhcp
|
# Cas du dhcp
|
||||||
if attr.__class__ in services_to_attrs['dhcp']:
|
if attr.__class__ in services_to_attrs['dhcp']:
|
||||||
dhcp=dydhcp()
|
|
||||||
if old_attrs.get('ipHostNumber', []) and old_attrs.get('macAddress', []):
|
if old_attrs.get('ipHostNumber', []) and old_attrs.get('macAddress', []):
|
||||||
if new_attrs.get('ipHostNumber', []) and new_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]):
|
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)
|
||||||
dhcp.del_host(str(old_attrs['ipHostNumber'][0]), str(old_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]))
|
dhcp.add_host(str(new_attrs['ipHostNumber'][0]), str(new_attrs['macAddress'][0]), str(new_attrs['host'][0]))
|
||||||
else:
|
else:
|
||||||
|
for server in config.dhcp_servers:
|
||||||
|
dhcp=dydhcp(server)
|
||||||
dhcp.del_host(str(old_attrs['ipHostNumber'][0]), str(old_attrs['macAddress'][0]))
|
dhcp.del_host(str(old_attrs['ipHostNumber'][0]), str(old_attrs['macAddress'][0]))
|
||||||
elif new_attrs.get('ipHostNumber', []) and new_attrs.get('macAddress', []):
|
elif new_attrs.get('ipHostNumber', []) and new_attrs.get('macAddress', []):
|
||||||
|
for server in config.dhcp_servers:
|
||||||
|
dhcp=dydhcp(server)
|
||||||
dhcp.add_host(str(new_attrs['ipHostNumber'][0]), str(new_attrs['macAddress'][0]), str(new_attrs['host'][0]))
|
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():
|
if service in services_to_time.keys():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue