Thanks Alex. Your blueprint is similar to mine, although consul.server in my case is taken from the cluster.first.entity sensor of a DynamicCluster. I've uploaded my code to https://github.com/rdowner/brooklyn-consul - can you spot anything odd there?
Thanks Richard. On 17 July 2017 at 10:58, Alex Heneveld <[email protected]> wrote: > > Hi Richard- > > What you're doing looks fine. Maybe something is wrong with the > "consul.serverReference" value, or there is a bug around special treatment > of parameters. The blueprint below shows what I think you're doing, > several ways, and all work, both in bash and in the config view (IE fully > resolved). If "consul.serverReference" doesn't resolve I see the values > you describe and I get a nice error in the Summary view when I try to use > it ( Error resolving config consul.serverReference, > $brooklyn:entity("MISSING"), ... NoSuchElementException: No entity matching > id). > > Can you share your blueprint? > > Best > Alex > > > location: localhost > services: > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > id: consul.server > launch.command: | > echo hello | nc -l 4321 & > echo $! > $PID_FILE > - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess > launch.command: | > echo hello | nc -l 4322 & > echo $! > $PID_FILE > brooklyn.config: > consul.serverReference: $brooklyn:entity("consul.server") > shell.env: > consul_join0: $brooklyn:entity(config("consu > l.serverReference")).attributeWhenReady("entity.id") > consul_join1: $brooklyn:entity(config("consu > l.join1")).attributeWhenReady("entity.id") > consul_join2: $brooklyn:config("consul.join2") > consul.join1: $brooklyn:config("consul.serverReference") > consul.join2: $brooklyn:entity(config("consu > l.serverReference")).attributeWhenReady("entity.id") > > END > > > > > On 17/07/2017 09:54, Richard Downer wrote: > >> Hello all. >> >> I have a catalog item for an entity type. This has a number of parameters, >> including one parameter which is intended to hold a reference to an >> entity. >> This works fine; I can see in the "config" pane of the entity this: >> >> consul.serverReference Consul Server (bootstrap) >> >> What I want to do is extract some of the referenced entity's attributes >> and >> use them in my entity's blueprint. I'm struggling to find out how to do >> that. While experimenting, I've ended up with this in my blueprint: >> >> consul.join1: $brooklyn:config("consul.serverReference") >> consul.join2: $brooklyn:entity(config("consu >> l.serverReference")) >> consul.join3: >> $brooklyn:component(config("consul.serverReference")) >> consul.join4: >> $brooklyn:config("consul.serverReference").attributeWhenReady("entity.id >> ") >> consul.join5: >> $brooklyn:entity(config("consul.serverReference")).attributeWhenReady(" >> entity.id") >> consul.join6: >> $brooklyn:component(config("consul.serverReference")).attrib >> uteWhenReady(" >> entity.id") >> >> None of those are resolving. They appear in the config pane looking like >> this: >> >> consul.join1 >> {"component":{"componentId":"","componentIdSupplier":null,"s >> copeComponent":null,"scope":"THIS"},"keyName":"consul.serverReference"} >> consul.join2 >> {"componentId":null,"componentIdSupplier":{"component":{" >> componentId":"","componentIdSupplier":null,"scopeComponent": >> null,"scope":"THIS"},"keyName":"consul.serverReference"},"sc >> opeComponent":null,"scope":"GLOBAL"} >> consul.join3 >> {"componentId":null,"componentIdSupplier":{"component":{" >> componentId":"","componentIdSupplier":null,"scopeComponent": >> null,"scope":"THIS"},"keyName":"consul.serverReference"},"sc >> opeComponent":null,"scope":"GLOBAL"} >> consul.join4 >> {"object":{"component":{"componentId":"","componentIdSupplie >> r":null,"scopeComponent":null,"scope":"THIS"},"keyName":" >> consul.serverReference"},"fnName":"attributeWhenReady","args":[" >> entity.id"]} >> consul.join5 >> {"component":{"componentId":null,"componentIdSupplier":{"com >> ponent":{"componentId":"","componentIdSupplier":null,"scopeC >> omponent":null,"scope":"THIS"},"keyName":"consul.serverRefer >> ence"},"scopeComponent":null,"scope":"GLOBAL"},"sensorName":" >> entity.id"} >> consul.join6 >> {"component":{"componentId":null,"componentIdSupplier":{"com >> ponent":{"componentId":"","componentIdSupplier":null,"scopeC >> omponent":null,"scope":"THIS"},"keyName":"consul.serverRefer >> ence"},"scopeComponent":null,"scope":"GLOBAL"},"sensorName":" >> entity.id"} >> >> Is it possible to do what I want? >> >> Thanks >> Richard. >> >> >
