brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [4/9] brooklyn-server git commit: fix inconsistency when type definitions come from anonymous BOMs vs named-bundles
Date Fri, 27 Oct 2017 11:26:09 GMT
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 <alex.heneveld@cloudsoftcorp.com>
Authored: Wed Oct 25 16:59:40 2017 +0100
Committer: Alex Heneveld <alex.heneveld@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";
                     }


Mime
View raw message