Github user ahgittin commented on the issue:
https://github.com/apache/brooklyn-server/pull/868
there's a few more subtle fixes in progress, but one i want to record here.
consider:
1) i upload a BOM containing `type1` and `type2` without a bundle name, say
it becomes `anonymous-brooklyn-wrapped-bom-bundle-11111:0.0.0-SNAPSHOT`
2) i update this and re-upload, with new definitions for the same types,
say now the bundle gets given a name
`anonymous-brooklyn-wrapped-bom-bundle-22222:0.0.0-SNAPSHOT`
in this case we _don't_ want to have multiple instances, and the
expectation is that the previous types are replaced by this one, then
`anonymous-bundle-11111` is noted as being empty (and it was noted as a wrapper
bundle) so it is removed. so we should allow replacement of types even from
different bundles _if_ the old one is a wrapper bundle.
but say now we
3) put `type1` in a full-fledged bundle call it `bund` (not a wrapper) and
install that, with again a different plan body
if this is allowed to replace `type1` then we get into a potentially
dangerous state on rebind, that if `bund` is read first and then
`anonymous-bundle-22222`, the latter bundle will fail because it can't install
an incompatible `type1`. we could try to load anonymous items first but not
sure we can guarantee this (eg if `type1` depends on something that is loaded
later). but if this _isn't_ allowed to replace `type1` then we make it hard to
move away from anonymous bundles.
if `bund` includes both `type1` and `type2`, which it normally would, then
there is no problem because the anonymous bundles will be deleted when we did
(3), but it's quite hard to check if `bund` redeclares everything or just a
subset from anonymous bundles.
what i think the resolution should be is that _only_ anonymous wrapper
bundles can give different definitions for types from other anonymous wrapper
bundles. this has two consequences:
(A) if you deploy anonymous BOMs which contain conflicting definitions of
types and some of them don't contain all the types then you may see different
definitions after rebind
(B) if you want to transition from a wrapped bundle to a full bundle, you
must keep the types the same and change in a subsequent deployment (or bump the
type's version which is probably wise anyway)
consqeuence (B) is fine i think. consequence (A) might be irritating but
it doesn't break rebind and we discourage anonymous bundles so I think we can
live with it.
@aledsage ?
---