How to set state in @hook code block?
john at arbash-meinel.com
Thu Jul 20 06:06:56 UTC 2017
I'm pretty sure hooks execute in the parent directory.
So if you have
you need to
On Jul 20, 2017 04:58, "fengxia" <fxia1 at lenovo.com> wrote:
> Hi Juju,
> I think I read at some point in the official document that you can't set
> state from hook.
> However, this is what I'm trying to achieve: in @hook('config-changed'), I
> will pass in a file path as a config value. Files are part of the charm so
> they are installed in /var/lib/juju/agents/unit-mycharm/myfiles/ on the
> unit node. But when @hook('config-changed') is triggered, my code to
> "open('/path/file')" actually complains "file not found". This makes me
> wonder that hook is not visible of the charm directory?
> So I'm thinking this can be worked around if I set_state("mystate") from
> hook. But doing so didn't trigger @when("mystate").
> What's the right way to do this then?
> Feng xia
> Lenovo USA
> Phone: 5088011794
> fxia1 at lenovo.com
> Twitter | Facebook | Instagram | Blogs | Forums
> Juju mailing list
> Juju at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailm
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Juju