You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by Richard Downer <ri...@apache.org> on 2017/06/29 08:48:54 UTC

Catalog adding unexpected behaviour

Hello all,

If I create a catalog.bom with these contents and try to add this to the
catalog with `br catalog add`:

brooklyn.catalog:
  version: 0.1.3.SNAPSHOT
  items:
    - id: inner
      itemType: entity
      item:
        services:
          - type: server
    - id: outer
      itemType: entity
      item:
        services:
          - type: inner

it fails with error `Server error (400): Could not resolve item 'outer'; 2
errors including: Transformer for Brooklyn OASIS CAMP interpreter gave an
error creating this plan: Unable to match plan item:
Service[name=<null>,description=<null>,serviceType=inner,characteristics=[],customAttributes={}]`

If I split this into two different catalog.bom files, and add them one
after the other, it works.

It seems to me that what works with two individual catalog.bom files should
also work when both files are combined into one. What do others think about
this?

Changing `entity` for `template` resolves this problem - as I understand
it, `template` causes in-depth parsing to be deferred until something tries
to use the catalog item. Unfortunately that means that some errors in the
catalog item may not be discovered until deployment time.

Richard.

Re: Catalog adding unexpected behaviour

Posted by Aled Sage <al...@gmail.com>.
Hi Richard,

Thanks for raising this. FYI Alex has created a PR with tests 
demonstrating the behaviour [1] you describe.

---

In the docs [2], we encourage the use of the format below for "entity" 
(because there is only one thing, the `services: ` is unnecessary and 
misleading - it suggests you could have multiple things under `services`):

    brooklyn.catalog:
       version: 0.1.3.SNAPSHOT
       items:
         - id: inner
           itemType: entity
           item:
             type: server
         - id: outer
           itemType: entity
           item:
             type: inner

In contrast, if you're adding a "template" (which can consist of 
multiple services), then the format would be:

    brooklyn.catalog:
       version: 0.1.3-SNAPSHOT
       items:
         - id: my-app
           itemType: template
           item:
             services:
    - type: server

If you use that format for `itemType: entity`, I think it works as expected.

Aled

[1] https://github.com/apache/brooklyn-server/pull/748

[2] http://brooklyn.apache.org/v/0.11.0/ops/catalog/



On 29/06/2017 09:48, Richard Downer wrote:
> Hello all,
>
> If I create a catalog.bom with these contents and try to add this to the
> catalog with `br catalog add`:
>
> brooklyn.catalog:
>    version: 0.1.3.SNAPSHOT
>    items:
>      - id: inner
>        itemType: entity
>        item:
>          services:
>            - type: server
>      - id: outer
>        itemType: entity
>        item:
>          services:
>            - type: inner
>
> it fails with error `Server error (400): Could not resolve item 'outer'; 2
> errors including: Transformer for Brooklyn OASIS CAMP interpreter gave an
> error creating this plan: Unable to match plan item:
> Service[name=<null>,description=<null>,serviceType=inner,characteristics=[],customAttributes={}]`
>
> If I split this into two different catalog.bom files, and add them one
> after the other, it works.
>
> It seems to me that what works with two individual catalog.bom files should
> also work when both files are combined into one. What do others think about
> this?
>
> Changing `entity` for `template` resolves this problem - as I understand
> it, `template` causes in-depth parsing to be deferred until something tries
> to use the catalog item. Unfortunately that means that some errors in the
> catalog item may not be discovered until deployment time.
>
> Richard.
>