GitHub user ahgittin opened a pull request:
https://github.com/apache/brooklyn-server/pull/799
[WIP] Uninstall bundles on error
When a bundle install (or auto-wrapped BOM install) fails, previously the
server would in some cases be left with that bundle partially installed and
some overwritten/replaced/removed items in their new state. To fix, a user
would have to complete a successful install for that bundle.
If left uncorrected, the server could subsequently fail rebind.
This PR changes behaviour so that on a failed install, the server reverts
to the state before the install.
All the various paths are catered for _except_ this PR does not yet
reinstall the old bundle. It is not guaranteed how that ZIP can be accessed.
We could peek at persistent state (if persistence is on) but probably a better
approach is for Brooklyn to keep a cache of installed bundles, in addition to
persisted state. (OSGi does this under the covers but it does not expose it.)
Different paths which _are_ addressed are:
* items from a bundle being replaced are restored
* items from other bundles being replaced by this bundle (eg anonymous
bundles for wrapped BOMs) are restored
* rebind following a failed install succeeds with no such bundle installed
* rebind following a failed reinstall succeeds with the previous bundle
installed (except as noted above)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ahgittin/brooklyn-server
uninstall-bundles-on-error
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/brooklyn-server/pull/799.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #799
----
commit 3566ac0c06ce89d552029b2f20bf26bf9f80fd81
Author: Alex Heneveld <[email protected]>
Date: 2017-08-16T08:36:41Z
tests for uninstall behaviour errors
two tests, both of which fail in osgi subclasses only:
- ensure failed bundle is uninstalled and rebind subsequently succeeds
- ensure on failure previous items are left in place
also adds placeholders where fixes are needed
commit 8127dbba4e0bdc8b20f7c9cc7a871e5cc8e19f8e
Author: Alex Heneveld <[email protected]>
Date: 2017-08-16T10:27:01Z
restore old registered types and bundle if new install fails
does everything except revert to the old OSGi bundle from persistence store
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---