Configuration & Administration

Subject: Deleting device properties that cause poskeyerrors

1.  Deleting device properties that cause poskeyerrors

Posted 6 days ago
There has been an IRC discussion recently where a device's macaddresses attribute could not be deleted.  It first showed up as a poskeyerror that none of the toolbox tools could fix.  Problem, in this case, was to do with the macaddresses attrribute of the device.  Tried various things in zendmd to delete the device and its interfaces, none of which worked.   See http://zenpackers.readthedocs.io/en/latest/bad_relations.html   for some suggestions.

In the end, cluther provided the right trick. In zendmd:
device = find('<id of device>')
device.macaddresses                                   (Gave the poskeyerror)

device.macaddresses = None ; commit()
for i in device.os.interfaces(): i.index_object() ; commit()

cluther comments:
"device.macaddresses is only there as a way to quickly lookup all of the MAC addresses on all of a device's interfaces without having to look at each interface. When the interfaces are indexed, they add their MAC address to their device's macaddresses property. In your case it seems that ZODB has lost track of that property (POSKeyError). Hopefully we can just replace it. "

Cheers,
Jane

------------------------------
Jane Curry
Skills 1st United Kingdom
jane.curry@skills-1st.co.uk
------------------------------