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