[objects] check_changes renvoie toujours
comme mon estomac
This commit is contained in:
parent
c2968c6b15
commit
4fbd45b66c
1 changed files with 5 additions and 3 deletions
|
@ -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:
|
||||
|
@ -693,7 +695,7 @@ class machine(CransLdapObject):
|
|||
oip6 = u""
|
||||
if oip6 != nip6:
|
||||
sbm['ip6HostNumber'] = (oip6, nip6)
|
||||
return sbm
|
||||
return sbm
|
||||
|
||||
def validate_changes(self):
|
||||
sbm = self.check_changes()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue