Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clean unused add-ons from a Plone site?

Tags:

plone

This is a general question but motivated by an example. The general question is: How to clean Plone sites from unused add-ons? You can generate an unused add-on in several ways, for example if you use one add-one for one thing and later you prefer another.

I'm starting learning about Plone and maybe I'm making some mistakes. But I think that some add-ons can make problems because they left some things that are not automatically uninstalled. Then my question is also about how to isolate the data from the possible add-ons footprints.

So, this is the example:

When I started with Plone I installed an add-on named zettwerk.ui. But later I uninstalled it. I removed the add-on using the Plone web interface and the buildout configuration. Then I got the problem: every time that I try to install another add-on an error message appears:

2012-04-28 00:21:54 INFO GenericSetup.rolemap Role / permission map imported.
2012-04-28 00:21:54 INFO GenericSetup.archetypetool Archetype tool imported.
2012-04-28 00:21:54 INFO GenericSetup.browserlayer Browser layers imported
2012-04-28 00:21:54 INFO GenericSetup.resourceregistry KSS registry imported.
2012-04-28 00:21:54 ERROR GenericSetup Step zettwerk.ui.disable_sunburst_patch has an invalid import handler
2012-04-28 00:21:54 INFO GenericSetup.rolemap Role / permission map imported.
2012-04-28 00:21:54 INFO GenericSetup.toolset Class zettwerk.ui.tool.tool.UITool not found for tool portal_ui_tool
2012-04-28 00:21:54 ERROR Zope.SiteErrorLog 1335586914.990.0334188015457 http://localhost:8080/Plone/portal_quickinstaller/installProducts
Traceback (innermost last):
  Module ZPublisher.Publish, line 126, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
  Module ZPublisher.Publish, line 46, in call_object
  Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 575, in installProducts
  Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 512, in installProduct
   - __traceback_info__: ('plone.app.theming',)
  Module Products.GenericSetup.tool, line 323, in runAllImportStepsFromProfile
   - __traceback_info__: profile-plone.app.theming:default
  Module Products.GenericSetup.tool, line 1080, in _runImportStepsFromContext
  Module Products.GenericSetup.tool, line 994, in _doRunImportStep
   - __traceback_info__: toolset
  Module Products.GenericSetup.tool, line 123, in importToolset
TypeError: 'NoneType' object is not callable
> /home/daniel/.buildout/eggs/Products.GenericSetup-1.6.3-py2.6.egg/Products/GenericSetup/tool.py(123)importToolset()
-> new_tool = tool_class(tool_id)

I put zettwerk.ui back in buildout.conf and then the error disappears. But I think that the solution is not clean. So, how can I remove zettwerk.ui from buildout without making problems?

like image 821
Daniel Hernández Avatar asked Apr 28 '12 13:04

Daniel Hernández


1 Answers

This has been fixed in GenericSetup 1.6.5: http://pypi.python.org/pypi/Products.GenericSetup/1.6.5 Updating to that version (included in Plone 4.1.4) should do the trick. (Latest stable release currently is Plone 4.1.5 with GenericSetup 1.6.6, so I would say go for that one.)

Explanation: during install, zettwerk.ui has told GenericSetup that it requires a tool. This tool is then created. During uninstall, the tool is removed, but it is still in the list of required tools. If zettwerk.ui is uninstalled but the package is still in your buildout and you install another add-on, then GenericSetup looks at the list of required tools and creates this tool again. When zettwerk.ui is not available, this will fail with the above error. GenericSetup 1.6.5 simply prints a warning in this case and happily continues.

I don't think wildcard.fixpersistentutilities works in this case, but I may be mistaken. For some reason I have so far managed to avoid needing that package.

like image 104
maurits Avatar answered Oct 11 '22 18:10

maurits