3

It seems some steps are not being run. Am I missing the place where I should specify these?

sureshvv
  • 4,234
  • 1
  • 26
  • 32

1 Answers1

4

No A reinstall of a package runs the uninstall profile an then the default profile.

[START UPDATE]

As @hvelarde commented: It does not automatically run a uninstall profile. It could do nothing or do the uninstallation in a different way.

But usually if there is a profile the profile is named uninstall and gets called in the install.py's uninstall method.

Example:

from plone.addon.config import PROJECTNAME
from Products.CMFCore.utils import getToolByName


def uninstall(self):
    setup_tool = getToolByName(self, 'portal_setup')
    setup_tool.runAllImportStepsFromProfile(
        'profile-{0}:uninstall'.format(PROJECTNAME),
        ignore_dependencies=True)

More Infos about a clean uninstall can be found on @keul's Blog post

Keep in mind: A plone addon does not have a uninstall functionality for sure.

[END UPDATE]

If you apply the latest the default profile, the version is set to specified version in the metadata.xml - Plone can no longer determine if the package needs a upgrade or not, respectively it assumes your package is up to date, since the packe version on the filesystem is equal to the one stored in the DB.

Install upgrade step

As long as package upgrade code follows some guidelines, the upgrade appears in the Plone Control Panel -> AddOns (http://localhost:8080/Plone/prefs_install_products_form)

You can now hit the upgrade button on the package, which has upgrades

enter image description here

Upgrade helpers

There are several packages, which helps you track new updates and install them.

Mathias
  • 6,777
  • 2
  • 20
  • 32
  • Hmm Thanks... Been using the portal_quickinstaller tool directly – sureshvv Feb 24 '15 at 10:02
  • I updated my answer with some addons, which makes upgrading a plone addons mostly painless :-) – Mathias Feb 24 '15 at 10:11
  • 3
    Just a clarification: uninstalling a package does not run the uninstall profile unless you explicitly declare that using the good old Extensions/Install.py script. You need also to register this using the directive on the package configure.zcml file. – hvelarde Feb 25 '15 at 16:19
  • Thanks @hvelarde for the important point - I updated the answer. – Mathias Feb 25 '15 at 16:58
  • What is the best practice? Is reinstall from portal_quickinstaller deprecated? – sureshvv Feb 27 '15 at 12:28
  • I personally try to follow the instructions of @keul's blog post. So a reinstall with quick_installer works perfectly, BUT a reinstall does not trigger upgrade steps. A reinstall of a package may work if there are only configuration changes (GenericSetup xml), But if a upgrade step manipulates persistent objects, a reinstall probably will put your data in a inconsistent state, which may break the addon. So if a package provides uprade steps run them thru the plone control panel, or with mentioned upgrade addon. If there are no upgrade steps, try to reinstall, but make a copy of your DB first. – Mathias Feb 27 '15 at 13:14
  • imho it's not deprecated, but it's only a convention to make a package reinstall-able/upgrade-able and depends on programmer mood :-) I cannot answer this for sure... – Mathias Feb 27 '15 at 13:19