Sorry Graham, once you replace the dot with the colon it will spit out an error since `org.apache.brooklyn.api.entity.Entity` does not contain a `cluster.first.entity` sensor. I'm testing it out myself looking for a solution for you.
-Mike On Wed, Mar 22, 2017 at 12:23 PM Mike Zaccardo < [email protected]> wrote: > 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> > > -- 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>
