Upgrader: refactor to make sure to execute post upgrade after upgrade activities
Often post-upgrader steps does not run because it is stuck in Is required run upgrade before solve it. You need run active sense once at least on this alarm.
The reason for that specific problem is because for portal_alarms.upgrader_check_upgrader.sense()
to work,
we need the active process created by this upgrade step to be reindexed,
but the post upgrade activity does not wait for it, so sometimes post upgrade is executed before the active process is reindexed, in other words, it is executed before the result of portal_alarms.upgrader_check_upgrader.sense()
can be trusted and instead of executing post upgrade, post upgrade just return this Is required solve Pre Upgrade first. You need run active sense once at least on this alarm message.
But in my understanding, this explicit check is not needed at all, so I prefer we remove it. If there was a reason I did not understand, please explain.
My understanding is that if for some reason site administrator decides to run only one upgrader step and not the full pre-upgrade, upgrade, post-upgrade chain the code should not prevent this.
Appart from using defaultActivateParameterDict(activate_kw, placeless=True)
to propagate dependency when creating the active process, this is a major refactoring that aims at simplifying the code by using more of the features already provided by alarms (for example fixit
instead of force
).
I have commited the changes to test in separate commits to explain what behavior changed exactly.
One notable change is also 430511cc where we strictly implement upgrader step is done in one transaction and do not try to be too clever and catch configuration mistakes.
Tests are still running in https://nexedi.erp5.net/test_result_module/20160726-265EA792/