<div dir="ltr">I'm not attempting to cause trouble here - I just want to make sure I understand the feature - and what effects it might have.<div><br></div><div>It sounds like any implementation of the default-hook would need to start with something like: (pseudo-bash)</div>
<div><br></div><div>if JUJU_HOOK_NAME == "start"</div><div> //run start</div><div><div>else if JUJU_HOOK_NAME == "config-changed"</div><div> //run config-changed</div></div>
<div><div>else if JUJU_HOOK_NAME == "stop"</div><div> //run stop</div></div><div>else</div><div> //unknown hook</div><div> exit 1</div><div>fi</div><div><br></div><div>Any default-hook that deviated from this pattern could find itself being run multiple times in succession - I wonder if that might be confusing/ unexpected to a charm author?</div>
<div>Gustavo's observation about hooks that the charm might no know about yet means that the else clause is absolutely required, I wonder if that's obvious to someone who's new to charming?</div><div><br></div>
<div>Just some thoughts - in principle I love the feature</div><div><br></div><div>Matt</div><div><br></div><div><br></div><div><br></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Tue, Aug 19, 2014 at 11:10 PM, Gustavo Niemeyer <span dir="ltr"><<a href="mailto:gustavo@niemeyer.net" target="_blank">gustavo@niemeyer.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Tue, Aug 19, 2014 at 6:58 PM, Matthew Williams<br>
<<a href="mailto:matthew.williams@canonical.com" target="_blank">matthew.williams@canonical.com</a>> wrote:<br>
> Something to be mindful of is that we will shortly be implementing a new<br>
> hook for metering (likely called collect-metrics). This hook differs<br>
> slightly to the others in that it will be called periodically (e.g. once<br>
> every hour) with the intention of sending metrics for that unit to the state<br>
> server.<br>
><br>
> I'm not sure it changes any of the details in this feature or the pr - but I<br>
> thought you should be aware of it<br>
<br>
</div>Yeah, that's a good point. I'm wonder how reliable the use of<br>
default-hook will be, as it's supposed to run whenever any given hook<br>
doesn't exist, so charms using that feature should expect _any_ hook<br>
to be called there, even those they don't know about, or that don't<br>
even exist yet. The charms that symlink into a single hook seem to be<br>
symlinking a few things, not everything. It may well turn out that<br>
default-hook will lead to brittle charms.<br>
<br>
<br>
gustavo @ <a href="http://niemeyer.net" target="_blank">http://niemeyer.net</a><br>
</blockquote></div><br></div></div>