Anyone who has ever written a switch statement should be used to putting in a default clause for "something I don't expect"... I don't think it should be a big deal.
On Wed, Aug 20, 2014 at 4:46 AM, Matthew Williams < matthew.willi...@canonical.com> wrote: > I'm not attempting to cause trouble here - I just want to make sure I > understand the feature - and what effects it might have. > > It sounds like any implementation of the default-hook would need to start > with something like: (pseudo-bash) > > if JUJU_HOOK_NAME == "start" > //run start > else if JUJU_HOOK_NAME == "config-changed" > //run config-changed > else if JUJU_HOOK_NAME == "stop" > //run stop > else > //unknown hook > exit 1 > fi > > 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? > 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? > > Just some thoughts - in principle I love the feature > > Matt > > > > > > On Tue, Aug 19, 2014 at 11:10 PM, Gustavo Niemeyer <gust...@niemeyer.net> > wrote: > >> On Tue, Aug 19, 2014 at 6:58 PM, Matthew Williams >> <matthew.willi...@canonical.com> wrote: >> > Something to be mindful of is that we will shortly be implementing a new >> > hook for metering (likely called collect-metrics). This hook differs >> > slightly to the others in that it will be called periodically (e.g. once >> > every hour) with the intention of sending metrics for that unit to the >> state >> > server. >> > >> > I'm not sure it changes any of the details in this feature or the pr - >> but I >> > thought you should be aware of it >> >> Yeah, that's a good point. I'm wonder how reliable the use of >> default-hook will be, as it's supposed to run whenever any given hook >> doesn't exist, so charms using that feature should expect _any_ hook >> to be called there, even those they don't know about, or that don't >> even exist yet. The charms that symlink into a single hook seem to be >> symlinking a few things, not everything. It may well turn out that >> default-hook will lead to brittle charms. >> >> >> gustavo @ http://niemeyer.net >> > >
-- Juju-dev mailing list Juju-dev@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev