[services] On vérifie qu'une clef de dico existe, on ignore les listes d'attributs vident

This commit is contained in:
Valentin Samir 2013-05-13 20:09:17 +02:00
parent b9fd6bbb91
commit 4c663875d8

View file

@ -180,8 +180,8 @@ def service_to_restart(conn, new=None, args=[], start=0):
def services_to_restart(conn, old_attrs={}, new_attrs={}):
"""Détermine quels sont les services à reconfigurer"""
old_attrs_c = dict((attributs.CRANS_ATTRIBUTES[key], value) for key,value in old_attrs.items())
new_attrs_c = dict((attributs.CRANS_ATTRIBUTES[key], value) for key,value in new_attrs.items())
old_attrs_c = dict((attributs.CRANS_ATTRIBUTES[key], value) for key,value in old_attrs.items() if key in attributs.CRANS_ATTRIBUTES.keys() and value)
new_attrs_c = dict((attributs.CRANS_ATTRIBUTES[key], value) for key,value in new_attrs.items() if key in attributs.CRANS_ATTRIBUTES.keys() and value)
created_attr = [ attr for name in new_attrs_c.keys() if not name in old_attrs_c.keys() for attr in new_attrs_c[name]]
deleted_attr = [ attr for name in old_attrs_c.keys() if not name in new_attrs_c.keys() for attr in old_attrs_c[name]]