How to clean unused add-ons from a Plone site? - 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?

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.

There are two possibilities.
First, do a backup :-)
Simplest, if the zettwerk.ui product you reinstalled is not the same version as the one you originally added, try reinstalling it. Product removal has been much improved over the years, and fewer products now exhibit this behavior.
If you still have the problem, add the product wildcard.fixpersistentutilities to your buildout, rerun the buildout, and navigate to /##fix-persistent-utilities on your site, looking for anything on that page that references zettwerk.ui. Remove it. Once you have no more references there, remove the zettwerk.ui product.
Actually, there's a third possibility: add a patch to zettwerk.ui to fix its uninstall!

Related

Make quintagroup.transmogrifier work (version conflict, configuration_id) (Plone)

I'd like to use transmogrifier to copy a little excerpt of the one Plone 4 site to another. I followed the instructions in the quintagroup documentation, e.g. here.
I added both collective.transmogrifier and quintagroup.transmogrifier to my buildout:
[instance]
eggs +=
Products.Marshall
collective.transmogrifier
quintagroup.transmogrifier
zcml +=
collective.transmogrifier
quintagroup.transmogrifier
However, the installed version 1.4 of collective.transmogrifier was not sufficient, since it lacks the traverse function in the utils module:
File ".../eggs/plone.app.transmogrifier-1.3-py2.7.egg/plone/app/transmogrifier/atschemaupdater.py", line 8, in <module>
from collective.transmogrifier.utils import traverse
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File ".../parts/instance/etc/site.zcml", line 15.2-15.55
ZopeXMLConfigurationError: File ".../parts/instance/etc/package-includes/027-quintagroup.transmogrifier-configure.zcml", line 1.0-1.70
ZopeXMLConfigurationError: File ".../eggs/quintagroup.transmogrifier-0.5-py2.7.egg/quintagroup/transmogrifier/configure.zcml", line 11.4-11.50
ZopeXMLConfigurationError: File ".../eggs/plone.app.transmogrifier-1.3-py2.7.egg/plone/app/transmogrifier/configure.zcml", line 9.2-12.8
ImportError: cannot import name traverse
I specified collective.transmogrifier = 1.5 in my versions.cfg, and then changed eggs/quintagroup.transmogrifier-0.5-py2.7.egg/EGG-INFO/requires.txt which insisted in collective.transmogrifier<1.5 (why?) to
collective.transmogrifier<=1.5
After rebuilding and restarting I was able to add the quintagroup.transmogrifier in the quickinstaller view.
However, when I tried to export the site in the Generic Setup Tool, I failed miserably:
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Products.GenericSetup.tool, line 583, in manage_exportSelectedSteps
Module Products.GenericSetup.tool, line 1038, in _doRunExportSteps
Module quintagroup.transmogrifier.exportimport, line 72, in exportSiteStructure
Module collective.transmogrifier.utils, line 118, in constructPipeline
Module quintagroup.transmogrifier.sitewalker, line 32, in __init__
Module collective.transmogrifier.utils, line 225, in __init__
AttributeError: Transmogrifier instance has no attribute 'configuration_id'
It didn't make a difference whether I saved the default export profile before or not.
Is there some configuration step missing, or is there some reason for the collective.transmogrifier <1.5 constraint? I'd like to see this work before taking on the task of selecting the whitelisted contents ...
I've come across this before, but I was able to avoid using quintagroup.transmogrifier in that case.
The pin was removed in this commit in master (though it was a little more complicated than that if you check the history of setup.py).
So basically you are going to have to check out that product in your buildout:
[sources]
...
quintagroup.transmogrifier = git https://github.com/collective/quintagroup.transmogrifier.git
and rerunning buildout (probably bin/buildout -c develop.cfg) should do it, though that should be considered a short term hack rather than a long term solution if you are doing it on production.
The long term solution is to build your own '0.5-tobias' egg using jarn.mkrelease or zest.releaser (more modern that mkrelease, but trickier to figure out) or raise an issue on https://github.com/collective/quintagroup.transmogrifier.git to ask someone to make an official release for you!

EC2 starcluster stopped working

Starcluster on EC2 ubuntu stopped working. I am not aware of any intentional configuration change or anything else and am unable to find much help. Can you please tell me if anyone has any suggestions? starting, terminating, or even listing clusters is erroring out. Below is the error I am getting when I try to listclusters:
ubuntu#ip-10-29-249-203:~$ starcluster listclusters
StarCluster - (http://star.mit.edu/cluster) (v. 0.94)
Software Tools for Academics and Researchers (STAR)
Please submit bug reports to starcluster#mit.edu
---------------------------------
revcls (security group: #sc-revcls)
---------------------------------
!!! ERROR - Unhandled exception occured
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/cli.py", line 274, in main
sc.execute(args)
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/commands/listclusters.py", line 36, in execute
show_ssh_status=self.opts.show_ssh_status)
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/cluster.py", line 290, in list_clusters
nodes = cl.nodes
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/cluster.py", line 720, in nodes
if n.is_master():
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/node.py", line 883, in is_master
return self.alias == "master"
File "/usr/local/lib/python2.7/dist-packages/StarCluster-0.94-py2.7.egg/starcluster/node.py", line 139, in alias
aliases = aliasestxt.splitlines()[2:]
AttributeError: 'NoneType' object has no attribute 'splitlines'
!!! ERROR - Oops! Looks like you've found a bug in StarCluster
!!! ERROR - Crash report written to: /home/ubuntu/.starcluster/logs/crash-report-1183.txt
!!! ERROR - Please remove any sensitive data from the crash report
!!! ERROR - and submit it to starcluster#mit.edu
Which version of StarCluster are you using? Is it the latest release or the latest dev version?
If I look at your error on the latest dev version, it refers to this line:
https://github.com/jtriley/StarCluster/blob/5442e91e159acca48b645f5ddf629d65c59cd7e0/starcluster/node.py#L139
My guess is that you are having an issue with your cluster alias tags. In any cases, it's very strange that even terminating the cluster and starting a new one doesn't solve the issue.
If you find anything more, can reproduce the issue or need more help, you may also use StarCluster mailing list. http://mailman.mit.edu/mailman/listinfo/starcluster

Using zopyx.smartprintng.plone receive "[Errno 111] Connection refused" when trying to generate PDF

Overview
A client contacted us requesting that when they fill in a form on their site (created with PloneFormGen), they want the input of the form sent to the customer in PDF format (the converted form must be then printed, signed and posted back to the customer).
I jumped on the Plone.org IRC room and asked the guys there, they suggested I use the zopyx.smartprintng.plone add-on. This seemed perfect because they have a script adapter example for PloneFormGen that I can use to convert the form input into a PDF file.
The docs for the add-on are on this page:
http://docs.produce-and-publish.com/#produce-publish-client-connector
Going on that I was told I only needed to install the "Produce and Publish Client Connector" I proceeded to follow the installation instructions on the documentation.
The Installation
The buildout installation went fine, it reported no errors at all and my buildout reflects exactly what they state it must on that installation documentation page.
However I noticed that under "Add/Remove Add-ons" in the Plone Control Panel, I could see no reference to this add-on, thus preventing me from actually enabling it on the particular site I am working on. (I have a feeling this may be the cause of the problem I am experiencing, but I have no idea how to resolve it). - I have checked portal_quickinstaller and it's not there either.
The Problem
According to the documentation appending ##asPlainPDF to the URL of the page you want to render will then render the PDF for you.
So I enter mysite.com/front-page/##asPlainPDF in my browser.
Upon doing this I receive this traceback:
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module zopyx.smartprintng.plone.browser.pdf, line 249, in __call__
Module zopyx.smartprintng.plone.browser.pdf, line 85, in __call__
Module zopyx.smartprintng.plone.browser.pdf, line 232, in __call2__
Module zopyx.smartprintng.client.zip_client, line 192, in convertZIP2
Module xmlrpclib, line 1224, in __call__
Module xmlrpclib, line 1578, in __request
Module xmlrpclib, line 1264, in request
Module xmlrpclib, line 1292, in single_request
Module xmlrpclib, line 1439, in send_content
Module httplib, line 954, in endheaders
Module httplib, line 814, in _send_output
Module httplib, line 776, in send
Module httplib, line 757, in connect
Module socket, line 571, in create_connection
error: [Errno 111] Connection refused
If you need more information than this please tell me where to get it and I shall provide it to you.
I have Google'd the error: [Errno 111] Connection refused message but it is either people experiencing issues with a Python program they are writing or a different add-on named zopyx.smartprintng.lite
I did find this thread however: https://groups.google.com/forum/#!msg/plone-users/wCuO4RCUIQk/VslwOXvs4XwJ
So as one user suggested I tried installing zopyx.smartprintng.server however that started complaining that I had the wrong version of zope.configuration, and wants >=3.8.0dev upon pinning that to 4.0.2 as it was the latest I could find, it then started complaining about another add-on and I got some buildout errors, which then bricked my Plone server (stopped the clients from coming up) and I had to re-run buildout from a backup buildout.cfg I made so it would make the necessary zope.conf files.
Server information
Plone 4.2.1.1 (4207)
CMF 2.2.6
Zope 2.13.16
Python 2.7.3 (default, Oct 18 2012, 15:13:00) [GCC 4.6.3]
Summary
Followed these installation instructions:
http://docs.produce-and-publish.com/#produce-publish-client-connector
Received the above traceback trying to convert PDF when appending ##asPlainPDF to URL
Attempts to install zopyx.smartprintng.server have failed.
The Produce-and-publish set of components does indeed require the server to be set up. The Plone product you installed is merely the integration point between Plone and that server.
Please to follow the instructions on http://docs.produce-and-publish.com/server/installation.html to install that separate server (it can have it's own buildout).
(If you run into problems with that installation, feel free to ask a new question here on Stack Overflow, or ask on the Plone Users mailinglist, or contact the author (which may require you to pay Zopyx for such support)).

Profiling Plone/Zope

What is current best practice for profiling Plone/Zope applications on a Plone 4.1/Zope 2.13 system?
Products.ZopeProfiler and the Plone.org version of CallProfiler both fail at install time with:
Traceback (most recent call last):
File "/home/derek/plone4/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/OFS/Application.py", line 689, in install_product
initmethod(context)
File "/home/derek/plone4/buildout-cache/eggs/Products.ZopeProfiler-2.0.1-py2.6.egg/Products/ZopeProfiler/__init__.py", line 8, in initialize
control_panel = context._ProductContext__app.Control_Panel
AttributeError: 'NoneType' object has no attribute 'Control_Panel'
z3c.profiler wants to install a lot of apparently-incompatible dependencies (not surprising since it's intended for Zope3).
collective.profiler looks promising, and installs, but doesn't let me profile the __call__ method of a View, because the method doesn't have a __dict__ attribute.
Have a look at repoze.profile and it's documentation. It runs as WSGI middleware component which aggregates profiling data across all requests to the WSGI application.
The ZopeProfiler in Version 2.0.2 works just fine with Plone 4.1

An error when trying to change Image workflow

In short, when I go into Site Setup -> Types and try and change the workflow for Images from "No Workflow" to any other workflow, I get the following error:
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module plone.app.controlpanel.types, line 165, in __call__
Module zope.event, line 31, in notify
Module zope.component.event, line 24, in dispatch
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module plone.app.discussion.browser.controlpanel, line 181, in notify_configuration_changed
AttributeError: 'NoneType' object has no attribute 'forInterface'
I suspect the way we setup this Plone instance caused the issue. We have a 4.0.8 install (Staging) where we did our initial site construction. We setup another 4.0.8 install for production. Ran a backup on Staging and copied the Staging backup files and blobstorage over to Production. Production worked fine; appeared to be a perfect clone of Staging.
Later, we wanted to move to 4.1.1, so we created another install on 4.1.1 and repeated the above process from Production to our new instance. After a day of testing, it appears to work. Cool, we have a 4.1.1 Production box now. Week later, users want Images to operate under the same workflow (Intranet/Extranet) as all the other content and that's when I ran into the error.
I can change the workflow through the ZMI portal_workflow tool without any apparent problems.
Looking at the product code, It seems that when you change the contenttype's workflow the p.a.discussion product tries to update its configuration but in your instance fails to retrieve the registry.
As a fast solution you could try to force the inclusion of the registry by adding in a zcml of one of your products this code:
<include package="plone.app.registry" />
then:
1- go to zmi -> your site and check if in your plone site exists an item called "portal_registry"
2- go to zmi -> your site -> tab "Components" and check if exists this registration:
<utility interface="plone.registry.interfaces.IRegistry"
object="portal_registry" />
Had the same problem, could solve it by importing the steps 'Manage the configuration registry' and ' Plone caching' of the profile 'Configuration registry'.

Resources