[objects] check_changes renvoie toujours

comme mon estomac
This commit is contained in:
Daniel STAN 2013-07-16 20:11:30 +02:00
parent c2968c6b15
commit 4fbd45b66c

View file

@ -653,11 +653,13 @@ class machine(CransLdapObject):
self._proprio._machines.remove(self)
def check_changes(self):
""" EXPLAIN WAT U DO !!!"""
old = {}
new = {}
sbm = {'rid' : (), 'ipHostNumber' : (), 'ip6HostNumber' : ()}
default = {'rid': -1, 'ipHostNumber': u'', 'macAddress': u''}
for i in ['rid', 'ipHostNumber', 'macAddress']:
# Try and may fail, then try again
try:
old[i] = self.attrs[i][0].value
except:
@ -678,13 +680,13 @@ class machine(CransLdapObject):
oip6 = u""
if oip6 != nip6:
sbm['ip6HostNumber'] = (oip6, nip6)
return sbm
# safer to cast everything to unicode
elif unicode(old['ipHostNumber']) != unicode(new['ipHostNumber']):
nrid = crans_utils.rid_of_ip4(new['ipHostNumber'])
orid = new['rid']
if nrid != orid:
sbm['rid'] = (orid, nrid)
return sbm
# safer not to cast (…)
elif old['macAddress'] != new['macAddress']:
nip6 = unicode(crans_utils.ip6_of_mac(new['macAddress'], new['rid']))
try: