Richard,
StatisSensor tries to resolve the value at the time of attaching to the entity, 
which is not yet started and doesn't have the attribute set.
Instead of setting the value it logs to debug log with a note of the failure 
(https://github.com/apache/incubator-brooklyn/blob/master/core/src/main/java/org/apache/brooklyn/core/sensor/StaticSensor.java#L69
 
<https://github.com/apache/incubator-brooklyn/blob/master/core/src/main/java/org/apache/brooklyn/core/sensor/StaticSensor.java#L69>)

Attributes resolve values at set time, whereas config keys resolve at get time 
- can't have a future as the value of an attribute. I would approach this with 
some kind of transformer which monitors the dependent values and updates the 
target sensor. No out of the box solution to be used in YAML though.

Svet.


> On 29.09.2015 г., at 0:24, Richard Downer <[email protected]> wrote:
> 
> Hi all,
> 
> I have a VanillaSoftwareProcess which is installing and running a web
> app (Jenkins, to be exact). I'd like to add a sensor which shows the
> URL of the webapp with the correct hostname and configured port
> number, so I add this to the blueprint:
> 
>  brooklyn.initializers:
>  - type: org.apache.brooklyn.core.sensor.StaticSensor
>    brooklyn.config:
>      name: jenkins.url
>      static.value: $brooklyn:formatString("http://%s:%s/";,
> attributeWhenReady("host.name"), config("jenkins.port"))
> 
> When I try this, the sensor is never populated. I can see it with a
> blank value if I toggle the "show all sensors" icon.
> 
> If I remove the attributeWhen Ready part - so the format string is
> only referring to the config - then the sensor is populated.
> 
> What's going on? Should I be able to use attributeWhenReady() with
> StaticSensor and VanillaSoftwareProcess?
> 
> Thanks all,
> Richard.


-- 
Cloudsoft Corporation Limited, Registered in Scotland No: SC349230. 
 Registered Office: 13 Dryden Place, Edinburgh, EH9 1RP
 
This e-mail message is confidential and for use by the addressee only. If 
the message is received by anyone other than the addressee, please return 
the message to the sender by replying to it and then delete the message 
from your computer. Internet e-mails are not necessarily secure. Cloudsoft 
Corporation Limited does not accept responsibility for changes made to this 
message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of 
viruses, it is the responsibility of the recipient to ensure that the 
onward transmission, opening or use of this message and any attachments 
will not adversely affect its systems or data. No responsibility is 
accepted by Cloudsoft Corporation Limited in this regard and the recipient 
should carry out such virus and other checks as it considers appropriate.

Reply via email to