You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by "Aled Sage (JIRA)" <ji...@apache.org> on 2017/03/16 15:03:41 UTC
[jira] [Commented] (BROOKLYN-454) DSL config evaluation fails for
inherited entity
[ https://issues.apache.org/jira/browse/BROOKLYN-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15928226#comment-15928226 ]
Aled Sage commented on BROOKLYN-454:
------------------------------------
This is not related to inherited config. I think a better name would be something like:
{noformat}
can't chain `$brooklyn:config("entity")` with subsequent DSL expressions
{noformat}
Try this blueprint:
{noformat}
location: localhost
services:
- type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
brooklyn.parameters:
- name: root.entity
type: org.apache.brooklyn.api.entity.Entity
brooklyn.config:
root.entity: $brooklyn:self()
launch.command: echo Launching
checkRunning.command: echo CheckRunning
stop.command: echo Stopping
launch.latch: $brooklyn:config("root.entity").attributeWhenReady("mysensor")
{noformat}
It fails to even deploy, giving back the error:
{noformat}
Error launching blueprint: Error resolving $brooklyn:config("root.entity").attributeWhenReady([mysensor]), in org.apache.brooklyn.util.core.task.BasicExecutionContext@5c3c0b8f([Wrapped[contextEntity:VanillaSoftwareProcessImpl{id=ir7jenazjs}], LocalManagementContext[Aa5aJoCe-Tm6SWtZJ]]): Error resolving $brooklyn:entity(org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.BrooklynDslCommon$DslFacades$EntitySupplier@3489e896).attributeWhenReady("mysensor"), in org.apache.brooklyn.util.core.task.BasicExecutionContext@5c3c0b8f([Wrapped[contextEntity:VanillaSoftwareProcessImpl{id=ir7jenazjs}], LocalManagementContext[Aa5aJoCe-Tm6SWtZJ]]): component-id blank, from org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.BrooklynDslCommon$DslFacades$EntitySupplier@3489e896
{noformat}
I think the problem is the DSL parsing doesn't understand that {{$brooklyn:config("root.entity")}} will return an entity, so it gives an error.
In contrast, the blueprint below does deploy:
{noformat}
location: localhost
services:
- type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
brooklyn.config:
launch.command: echo Launching
checkRunning.command: echo CheckRunning
stop.command: echo Stopping
launch.latch: $brooklyn:self().attributeWhenReady("mysensor")
{noformat}
> DSL config evaluation fails for inherited entity
> ------------------------------------------------
>
> Key: BROOKLYN-454
> URL: https://issues.apache.org/jira/browse/BROOKLYN-454
> Project: Brooklyn
> Issue Type: Bug
> Environment: Brooklyn 0.11.0-SNAPSHOT
> Reporter: Duncan Godwin
>
> Brooklyn seems to evaluate {{$brooklyn:config}} correctly in a latch when inheriting the value from a parent. The following used to work in Apache Brooklyn 0.10.0 but no longer does:
> {code}
> location: localhost
> services:
> - type: org.apache.brooklyn.entity.stock.BasicApplication
> name: my-parent
> brooklyn.config:
> root.entity: $brooklyn:self()
> brooklyn.children:
> - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
> name: my-child
> brooklyn.config:
> launch.command: echo Launching
> checkRunning.command: echo CheckRunning
> stop.command: echo Stopping
> launch.latch: $brooklyn:config("root.entity").attributeWhenReady("sensorInParent")
> {code}
> The following does work:
> {code}
> location: localhost
> services:
> - type: org.apache.brooklyn.entity.stock.BasicApplication
> name: my-parent
> brooklyn.config:
> root.entity: $brooklyn:self()
> brooklyn.children:
> - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
> name: my-child
> brooklyn.initializers:
> - type: org.apache.brooklyn.core.sensor.StaticSensor
> brooklyn.config:
> name: root.entity
> targetType: org.apache.brooklyn.api.entity.Entity
> static.value: $brooklyn:config("root.entity")
> brooklyn.config:
> launch.command: echo Launching
> checkRunning.command: echo CheckRunning
> stop.command: echo Stopping
> launch.latch: $brooklyn:attributeWhenReady("root.entity").attributeWhenReady("sensorInParent")
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
Re: [jira] [Commented] (BROOKLYN-454) DSL config evaluation fails for
inherited entity
Posted by Alex Heneveld <al...@cloudsoftcorp.com>.
I think you can say
$brooklyn:entity(config("entity")).attributeWhenReady("sensor") - is that
good enough (and notify this in the docs)?
On 16 Mar 2017 15:03, "Aled Sage (JIRA)" <ji...@apache.org> wrote:
[ https://issues.apache.org/jira/browse/BROOKLYN-454?page=
com.atlassian.jira.plugin.system.issuetabpanels:comment-
tabpanel&focusedCommentId=15928226#comment-15928226 ]
Aled Sage commented on BROOKLYN-454:
------------------------------------
This is not related to inherited config. I think a better name would be
something like:
{noformat}
can't chain `$brooklyn:config("entity")` with subsequent DSL expressions
{noformat}
Try this blueprint:
{noformat}
location: localhost
services:
- type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
brooklyn.parameters:
- name: root.entity
type: org.apache.brooklyn.api.entity.Entity
brooklyn.config:
root.entity: $brooklyn:self()
launch.command: echo Launching
checkRunning.command: echo CheckRunning
stop.command: echo Stopping
launch.latch: $brooklyn:config("root.entity").attributeWhenReady("
mysensor")
{noformat}
It fails to even deploy, giving back the error:
{noformat}
Error launching blueprint: Error resolving $brooklyn:config("root.entity"
).attributeWhenReady([mysensor]), in org.apache.brooklyn.util.core.
task.BasicExecutionContext@5c3c0b8f([Wrapped[contextEntity:
VanillaSoftwareProcessImpl{id=ir7jenazjs}],
LocalManagementContext[Aa5aJoCe-Tm6SWtZJ]]):
Error resolving $brooklyn:entity(org.apache.brooklyn.camp.brooklyn.spi.
dsl.methods.BrooklynDslCommon$DslFacades$EntitySupplier@
3489e896).attributeWhenReady("mysensor"), in org.apache.brooklyn.util.core.
task.BasicExecutionContext@5c3c0b8f([Wrapped[contextEntity:
VanillaSoftwareProcessImpl{id=ir7jenazjs}],
LocalManagementContext[Aa5aJoCe-Tm6SWtZJ]]):
component-id blank, from org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.
BrooklynDslCommon$DslFacades$EntitySupplier@3489e896
{noformat}
I think the problem is the DSL parsing doesn't understand that
{{$brooklyn:config("root.entity")}} will return an entity, so it gives an
error.
In contrast, the blueprint below does deploy:
{noformat}
location: localhost
services:
- type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
brooklyn.config:
launch.command: echo Launching
checkRunning.command: echo CheckRunning
stop.command: echo Stopping
launch.latch: $brooklyn:self().attributeWhenReady("mysensor")
{noformat}
> DSL config evaluation fails for inherited entity
> ------------------------------------------------
>
> Key: BROOKLYN-454
> URL: https://issues.apache.org/jira/browse/BROOKLYN-454
> Project: Brooklyn
> Issue Type: Bug
> Environment: Brooklyn 0.11.0-SNAPSHOT
> Reporter: Duncan Godwin
>
> Brooklyn seems to evaluate {{$brooklyn:config}} correctly in a latch when
inheriting the value from a parent. The following used to work in Apache
Brooklyn 0.10.0 but no longer does:
> {code}
> location: localhost
> services:
> - type: org.apache.brooklyn.entity.stock.BasicApplication
> name: my-parent
> brooklyn.config:
> root.entity: $brooklyn:self()
> brooklyn.children:
> - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
> name: my-child
> brooklyn.config:
> launch.command: echo Launching
> checkRunning.command: echo CheckRunning
> stop.command: echo Stopping
> launch.latch: $brooklyn:config("root.entity").attributeWhenReady("
sensorInParent")
> {code}
> The following does work:
> {code}
> location: localhost
> services:
> - type: org.apache.brooklyn.entity.stock.BasicApplication
> name: my-parent
> brooklyn.config:
> root.entity: $brooklyn:self()
> brooklyn.children:
> - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
> name: my-child
> brooklyn.initializers:
> - type: org.apache.brooklyn.core.sensor.StaticSensor
> brooklyn.config:
> name: root.entity
> targetType: org.apache.brooklyn.api.entity.Entity
> static.value: $brooklyn:config("root.entity")
> brooklyn.config:
> launch.command: echo Launching
> checkRunning.command: echo CheckRunning
> stop.command: echo Stopping
> launch.latch: $brooklyn:attributeWhenReady("root.entity").
attributeWhenReady("sensorInParent")
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)