Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/746#discussion_r127245988
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java
 ---
    @@ -81,22 +91,54 @@ public CatalogBundleLoader(Predicate<Bundle> 
applicationsPermitted, ManagementCo
             if (null != bom) {
                 LOG.debug("Found catalog BOM in {} {} {}", 
CatalogUtils.bundleIds(bundle));
                 String bomText = readBom(bom);
    -            String bomWithLibraryPath = addLibraryDetails(bundle, bomText);
    -            catalogItems = 
this.managementContext.getCatalog().addItems(bomWithLibraryPath, mb);
    -            for (CatalogItem<?, ?> item : catalogItems) {
    -                LOG.debug("Added to catalog: {}, {}", 
item.getSymbolicName(), item.getVersion());
    +            if (mb==null) {
    +                LOG.warn("Bundle "+bundle+" containing BOM is not managed 
by Brooklyn; using legacy item installation");
    +                legacy = true;
    +            }
    +            if (legacy) {
    +                catalogItems = 
this.managementContext.getCatalog().addItems(bomText, mb, force);
    +                for (CatalogItem<?, ?> item : catalogItems) {
    +                    LOG.debug("Added to catalog: {}, {}", 
item.getSymbolicName(), item.getVersion());
    +                }
    +            } else {
    +                
this.managementContext.getCatalog().addTypesFromBundleBom(bomText, mb, force);
    +                if (validate) {
    +                    Map<RegisteredType, Collection<Throwable>> 
validationErrors = this.managementContext.getCatalog().validateTypes(
    +                        
this.managementContext.getTypeRegistry().getMatching(RegisteredTypePredicates.containingBundle(mb.getVersionedName()))
 );
    +                    if (!validationErrors.isEmpty()) {
    +                        throw Exceptions.propagate("Failed to install 
"+mb.getVersionedName()+", types "+validationErrors.keySet()+" gave errors",
    +                            Iterables.concat(validationErrors.values()));
    +                    }
    +                }
    +            }
    +            
    +            if (!legacy && 
BasicBrooklynCatalog.isNoBundleOrSimpleWrappingBundle(managementContext, mb)) {
    +                
((ManagementContextInternal)managementContext).getOsgiManager().get().addInstalledWrapperBundle(mb);
                 }
             } else {
                 LOG.debug("No BOM found in {} {} {}", 
CatalogUtils.bundleIds(bundle));
             }
     
             if (!applicationsPermitted.apply(bundle)) {
    --- End diff --
    
    maybe we should even just get rid of this 'if' and should just let the 
bundle install apps?
    
    the applications whitelist was a feature of the `CatalogBomScanner` but do 
we really need to do it? On thinking about it, why not just do without the new 
`removeApplications` method below, and let it install apps (templates)?


---
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.
---

Reply via email to