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

    https://github.com/apache/incubator-brooklyn/pull/1039#discussion_r45317891
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
 ---
    @@ -558,15 +561,34 @@ private void collectCatalogItems(String sourceYaml, 
Map<?,?> itemMetadata, List<
                 throw new IllegalStateException("Could not resolve plan once 
id and itemType are known (recursive reference?): "+sourceYaml);
             }
             String sourcePlanYaml = planInterpreter.getPlanYaml();
    -        
    -        CatalogItemDtoAbstract<?, ?> dto = createItemBuilder(itemType, 
symbolicName, version)
    +
    +        CatalogItemBuilder itemBuilder = createItemBuilder(itemType, 
symbolicName, version)
                 .libraries(libraryBundles)
                 .displayName(displayName)
                 .description(description)
                 .deprecated(catalogDeprecated)
                 .iconUrl(catalogIconUrl)
    -            .plan(sourcePlanYaml)
    -            .build();
    +            .plan(sourcePlanYaml);
    +        if (itemType.equals(CatalogItemType.ENTITY) || 
itemType.equals(CatalogItemType.TEMPLATE)) {
    +            String stringServiceType = getFirstAs(itemAsMap, String.class, 
"type").orNull();
    +            // This is not a single item but a services based YAML
    +            if (stringServiceType == null) {
    +                final List<Map<?, ?>> services = getFirstAs(itemAsMap, 
List.class, "services").orNull();
    +                if (services.isEmpty()) {
    +                    throw new IllegalStateException("Services are empty: " 
+ sourceYaml);
    +                }
    +                stringServiceType = services.get(0).get("type").toString();
    --- End diff --
    
    The YAML let you add more than one services but Brooklyn will ultimately 
[deploys the entity only if it contains only one 
service](https://issues.apache.org/jira/browse/BROOKLYN-195?jql=project%20%3D%20BROOKLYN).
 That's why I'm checking only the first one.


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