[ 
https://issues.apache.org/jira/browse/BROOKLYN-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15331936#comment-15331936
 ] 

Aled Sage commented on BROOKLYN-297:
------------------------------------

There is a workaround for this, using the config {{defaultDisplayName}}. See:
* https://github.com/apache/brooklyn-server/pull/200
* https://github.com/apache/brooklyn-server/pull/201

For example:

{noformat}
brooklyn.catalog:
  version: 1.0.0
  items:
  - id: docker-container
    itemType: entity
    item:
      type: ...
      brooklyn.parameters:
        - name: imageName
          type: string
      brooklyn.config:
        defaultDisplayName:
          $brooklyn:formatString:
          - "Container: %s"
          - $brooklyn:config("imageName")
      ...
{noformat}

Note this only works for some things in the DSL, because the 
{{defaultDisplayName}} is resolved in the entity's {{init()}} method. 
Referencing config on your own entity will work, but potentially not 
referencing other entities (because they might not be managed/instantiated 
yet), and not using "attributeWhenReady" (because that would block the entity's 
initialisation).

> Support yaml DSL for "name"
> ---------------------------
>
>                 Key: BROOKLYN-297
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-297
>             Project: Brooklyn
>          Issue Type: Improvement
>    Affects Versions: 0.9.0
>            Reporter: Aled Sage
>            Priority: Minor
>
> When providing the name of an entity in yaml, it would be good to be able to 
> use DSL as we can for config.
> For example, we have a catalog item for an entity that creates a docker 
> container. A natural name for it would be the prefix "Container: " followed 
> by the image name (as illustrated in the syntax below).
> {noformat}
> brooklyn.catalog:
>   version: 1.0.0
>   items:
>   - id: docker-container
>     itemType: entity
>     item:
>       type: ...
>       brooklyn.parameters:
>         - name: imageName
>           type: string
>       name:
>         $brooklyn:formatString:
>         - "Container: %s"
>         - $brooklyn:config("imageName")
>       ...
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to