You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2017/10/27 11:26:09 UTC
[4/9] brooklyn-server git commit: fix inconsistency when type
definitions come from anonymous BOMs vs named-bundles
fix inconsistency when type definitions come from anonymous BOMs vs named-bundles
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/7b45a567
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/7b45a567
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/7b45a567
Branch: refs/heads/master
Commit: 7b45a56704f24df72a45c0915ac5d2a5f9d41aae
Parents: 0801cb1
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Oct 25 16:59:40 2017 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Oct 25 16:59:40 2017 +0100
----------------------------------------------------------------------
.../brooklyn/core/typereg/BasicBrooklynTypeRegistry.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7b45a567/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java b/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java
index a5e781b..663e6a5 100644
--- a/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java
+++ b/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java
@@ -404,11 +404,12 @@ public class BasicBrooklynTypeRegistry implements BrooklynTypeRegistry {
}
Set<String> oldContainingBundlesToRemove = MutableSet.of();
+ boolean newIsWrapperBundle = isWrapperBundle(type.getContainingBundle());
for (RegisteredType existingT: knownMatchingTypesByBundles.values()) {
String reasonForDetailedCheck = null;
boolean sameBundle = Objects.equals(existingT.getContainingBundle(), type.getContainingBundle());
boolean oldIsWrapperBundle = isWrapperBundle(existingT.getContainingBundle());
- if (sameBundle || oldIsWrapperBundle) {
+ if (sameBundle || (oldIsWrapperBundle && newIsWrapperBundle)) {
// allow replacement (different plan for same type) if either
// it's the same bundle or the old one was a wrapper, AND
// either we're forced or in snapshot-land
@@ -435,6 +436,10 @@ public class BasicBrooklynTypeRegistry implements BrooklynTypeRegistry {
} else {
reasonForDetailedCheck = "the type is not a SNAPSHOT and addition is not forced";
}
+ } else if (oldIsWrapperBundle) {
+ reasonForDetailedCheck = type.getId()+" is in a named bundle replacing an item from an anonymous bundle-wrapped BOM, so definitions must be the same (or else give it a different version)";
+ } else if (newIsWrapperBundle) {
+ reasonForDetailedCheck = type.getId()+" is in an anonymous bundle-wrapped BOM replacing an item from a named bundle, so definitions must be the same (or else give it a different version)";
} else {
reasonForDetailedCheck = type.getId()+" is defined in different bundle";
}