Thanks to the_jack providing access to his box, got a fix. See this ticket for info: http://dev.zenoss.loc/trac/ticket/7196.
You can fix everything like so:
$ zenpatch 22038 $ zendmd >>> for b in dmd.global_catalog(): ... dmd.global_catalog.catalog_object(b.getObject(), idxs=["allowedRolesAndUsers"]) ... >>> commit()
I'm not yet clear on the conditions that bring out this bug in CMFCore, but this will definitely take care of it.
This fix will be in 3.0.2 as well.
for b in dmd.global_catalog():dmd.global_catalog.catalog_object(b.getObject(),idxs=["allowedRolesAndUsers"])commit()
s_aldinger: Sorry, should have said: restart Zenoss after you patch in the change, otherwise nothing's got the new code and will still do it the old way.
Adrian: The fix will apply to Locations just as devices, so this is a different issue. Run these two things:
>>> from Products.Zuul.interfaces import ICatalogTool
They should give you two numbers that are a) not zero, and b) the same.
They do both produce the same non-zero output,
>>> from Products.Zuul.interfaces import ICatalogTool>>> ICatalogTool(dmd).search('Products.ZenModel.Location.Location').total16<objectImplements="Products.ZenModel.Location.Location"))16
There are however 19 devices in my system. I did the following,
>>> [l.id for l in dmd.global_catalog(objectImplements="Products.ZenModel.Location.Location")]
['NL', 'nkf.ams', 'ixn5.ams', 'gsw.ams', 'tc2.ams', 'UK', 'thn.lon', 'the.lon', 'ifl2.man', 'FR', 'eq2.par', 'th2.par', 'ixn3.ams', 'DE', 'ixn1.fra', 'Locations']
Should my Device (mainly switch) objects also respond to objectImplements="Products.ZenModel.Location.Location" in order for them to be included in the Location hierarchy?
Not at all. So, wait, sorry, perhaps I misunderstood. Is the problem that the locations aren't visible, or that the devices aren't visible in the locations?
The latter, the devices aren't visible in the locations.
As with the previous issue, if I got to the Zope DMD interface and navigate to,
I can see the proper Devices (switches) listed.
Okay, let's walk this through.
First, let's see what is indexed for devices. Pick a device in a location, doesn't matter which. Get its id. Then:
$ zendmd >>> brain = dmd.global_catalog(id='mydeviceid') >>> dmd.global_catalog._catalog.indexes['path']._unindex[brain.getRID()]
Those are all the paths under which the device was found. If the location path is in there, it's something else. If it isn't, do:
>>> from Products.Zuul.catalog.global_catalog import IndexableWrapper >>> device = brain.getObject() >>> for p in IndexableWrapper(device).path(): ... print '/'.join(p)
Check to see if the location path is in there.
brain = dmd.global_catalog(id='arcturus.packetrade.com')dmd.global_catalog._catalog.indexes['path']._unindex[brain.getRID()]OOSet(['/zport/dmd/Devices/Network/Switch/Foundry/devices/arcturus.packetrade.com', '/zport/dmd/Networks/c.d.65.0/c.d.65.56/ipaddresses/c.d.65.61/device', '/zport/dmd/Networks/a.b.184.0/a.b.184.0/ipaddresses/a.b.184.2/device', '/zport/dmd/Networks/a.b.184.0/a.b.184.136/ipaddresses/a.b.184.137/device', '/zport/dmd/Networks/a.b.184.0/a.b.184.140/ipaddresses/a.b.184.142/device', '/zport/dmd/Networks/a.b.184.0/a.b.184.224/ipaddresses/a.b.184.225/device', '/zport/dmd/Networks/a.b.184.0/a.b.184.32/ipaddresses/a.b.184.34/device'])
device = brain.getObject()for p in IndexableWrapper(device).path(): print '/'.join(p)/zport/dmd/Devices/Network/Switch/Foundry/devices/arcturus.packetrade.com/zport/dmd/Locations/NL/tc2.ams/devices/arcturus.packetrade.com/zport/dmd/Networks/a.b.184.0/a.b.184.224/ipaddresses/a.b.184.225/device/zport/dmd/Networks/a.b.184.0/a.b.184.136/ipaddresses/a.b.184.137/device/zport/dmd/Networks/a.b.184.0/a.b.184.140/ipaddresses/a.b.184.142/device/zport/dmd/Networks/a.b.184.0/a.b.184.0/ipaddresses/a.b.184.2/device/zport/dmd/Networks/a.b.184.0/a.b.184.32/ipaddresses/a.b.184.34/device/zport/dmd/Networks/c.d.65.0/c.d.65.56/ipaddresses/c.d.65.61/device
This works for only 1 pageview. If I click on Infrastructure, it is blank until I run the code you posted. Whe the for loop is finished, the devices appear, but I get this in zendmd:
>>> for b in dmd.global_catalog():
... dmd.global_catalog.catalog_object(b.getObject(), idxs=["allowedRolesAndUsers"])
Traceback (most recent call last):
File "<console>", line 2, in <module>
File "/opt/zenoss/lib/python/Products/ZCatalog/CatalogBrains.py", line 92, in getObject
target = parent.restrictedTraverse(path[-1])
File "/opt/zenoss/lib/python/OFS/Traversable.py", line 310, in restrictedTraverse
return self.unrestrictedTraverse(path, default, restricted=True)
File "/opt/zenoss/lib/python/OFS/Traversable.py", line 293, in unrestrictedTraverse
This bug made us revert back to 2.5.2 the first time we upgraded. Each time I visit the Infrastructure page, I must run this code in zendmd to make the devices appear. I've applied the patch as well. Any suggestions? I've restarted zenoss since running the code/patch.
I still get the error, but I just wanted to leave the comment that my Infrastruture appears if I let the page stay there for 2 mins. It doesn't indicate that it's loading, but I guess thats AJAX for you.
Added a new device class causes the device list to disappear (except for groups, locations and systems organizers), until 2 mins later when it will reappear.
Follow Us On Twitter »
||Latest from the Zenoss Blog »||Community||Products||Services||Customers||About Us|
Copyright © 2005-2011 Zenoss, Inc.