OK, Stupid mistake.
So, when I changed it to colon, I got the error:
2017-03-22 15:41:43,612 WARN  o.a.b.c.b.s.d.BrooklynDslInterpreter 
[brooklyn-jetty-server-8081-qtp434786215-42]: Error evaluating node 
(rethrowing) '$brooklyn:sensor("org.apache.brooklyn.api.entity.Entity", 
"cluster.first.entity").attributeWhenReady("host.name")': 
org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: Sensor 
cluster.first.entity not found on class 
org.apache.brooklyn.api.entity.Entity

So I changed the Cast:

          enricher.targetValue: 
$brooklyn:sensor("org.apache.brooklyn.entity.group.AbstractGroup", 
"cluster.first.entity").attributeWhenReady("host.name")

Now I get:

2017-03-22 15:43:50,909 WARN  o.a.b.c.b.s.d.BrooklynDslInterpreter 
[brooklyn-jetty-server-8081-qtp434786215-2217]: Error evaluating node 
(rethrowing) 
'$brooklyn:sensor("org.apache.brooklyn.entity.group.AbstractGroup", 
"cluster.first.entity").attributeWhenReady("host.name")': 
java.lang.IllegalArgumentException: Not permitted to invoke function on 
'class org.apache.brooklyn.core.sensor.BasicAttributeSensor' (outside 
allowed package scope)

Thanks
G



From:   Mike Zaccardo <[email protected]>
To:     Brooklyn dev <[email protected]>
Date:   03/22/2017 03:30 PM
Subject:        Re: Trouble with YAML Transformer



Hi Graham,

In your `enricher.targetValue` -- `$brooklyn.sensor` should be
`$brooklyn:sensor`
(the dot replaced by a colon).

If that does not solve it, try providing the `enricher.targetValue` with
string, like so:

    brooklyn.enrichers:
      - type: org.apache.brooklyn.enricher.stock.Transformer
        brooklyn.config:
          enricher.sourceSensor: $brooklyn:sensor("cluster.first.entity")
          enricher.targetSensor: $brooklyn:sensor("cluster_first_host")
          enricher.targetValue:
            $brooklyn:formatString:
            - "%s"
            -
$brooklyn:sensor("org.apache.brooklyn.api.entity.Entity",
"cluster.first.entity").attributeWhenReady("
host.name")

I hope this helps.

Cheers,
Mike

On Wed, Mar 22, 2017 at 12:10 PM Graham Ashby <[email protected]>
wrote:

What I want is an attribute that I can include in a template.
I'm trying to get the host.name of the first entity in the cluster, so
what I've got is:

    brooklyn.enrichers:
      - type: org.apache.brooklyn.enricher.stock.Transformer
        brooklyn.config:
          enricher.sourceSensor: $brooklyn:sensor("cluster.first.entity")
          enricher.targetSensor: $brooklyn:sensor("cluster_first_host")
          enricher.targetValue:
$brooklyn.sensor("org.apache.brooklyn.api.entity.Entity",
"cluster.first.entity").attributeWhenReady("host.name")

But I get the literal value
"$brooklyn.sensor("org.apache.brooklyn.api.entity.Entity",
"cluster.first.entity").attributeWhenReady("host.name")"

So, what am I doing wrong?

Thanks
Graham

-- 

Mike Zaccardo

Senior Software Engineer

Skype: mike.cloudsoft

Twitter: @ItsMeMikeZ <https://twitter.com/ItsMeMikeZ> LinkedIn:
linkedin.com/in/mike-zaccardo
<https://www.linkedin.com/in/mike-zaccardo-aa3ab812>

[image: Cloudsoft Logo.jpg] <https://cloudsoft.io/>

Stay up to date with everything Cloudsoft:

[image: Twitter_Logo_White_On_Blue.png] <https://twitter.com/cloudsoft> 
[image:
YouTube-social-icon_red_48px.png]
<https://www.youtube.com/channel/UCpbLhvXrYWz8B_osUX6rn0Q>




Reply via email to