Cool! I'll work that into my charms tomorrow. Might as well go all out on
the new stuff ;)

Tom
On 17 Feb 2016 18:48, "Marco Ceppi" <marco.ce...@canonical.com> wrote:

> This is awesome, glad to see this wrapped in the reactive framework. Will
> make a lot of my layers much simpler!
>
> Marco
>
> On Wed, Feb 17, 2016 at 1:44 PM Cory Johns <cory.jo...@canonical.com>
> wrote:
>
>> Just wanted to give a heads-up about a feature that landed in the
>> reactive base layer yesterday.
>>
>> If a charm config option has changed, the state "config.changed" will be
>> set for the duration of the hook.  Additionally, specific states will be
>> set for each config option that changed; that is, if option "foo" has
>> changed, the state "config.changed.foo" will be set.  An example of code
>> using this would be:
>>
>>     @when('myservice.started', 'config.changed')
>>     def update_config():
>>         update_config_files()
>>         restart_myservice()
>>
>> This provides a much cleaner way of detecting changes to config, and it
>> is recommended that this be used in favor of @hook('config-changed') going
>> forward, as the latter can actually run in to some situations, albeit
>> rather rarely, where the charm sees new config option values before the
>> config-changed hook has fired.  Using the reactive states avoids that
>> completely as well as working more naturally with existing @when decorators.
>>
>> Please note that, while we are not aware of any charms currently using
>> "config.changed" as a state, there is some risk of the state set by the
>> base layer conflicting with it if set by the charm layer.  The
>> recommendation is to always prefix your states by the name of the layer
>> setting them,  or the relation name for interface layers.
>> --
>> Juju mailing list
>> Juju@lists.ubuntu.com
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/juju
>>
>
> --
> Juju mailing list
> Juju@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju
>
>
-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju

Reply via email to