I would expect a lot of people will implement their charms as a single
script (especially given the number of charms we've seen implemented that
way even with minimal support for it).  If the special hook file is called
"default-hook", it makes those single-script charms seem like less of a
hack than if the single file is called "missing-hook".  It would also makes
more sense to a new charm author, I think.

One possibility is to give the charm author the ability to specify the name
of the default/missing hook file in the charm metadata... this could serve
dual purpose as both indication of use of the feature and definition of the
name of the file.  For charms that use multiple hook scripts, they could
define it to be "missing-hook" and for charms that use just a single
script, they could define it to be "hook" or "all-hooks".

That's a little more configuration for the charm author to set.  Not sure
if that's better or worse than having one set name for the script, which
may be more or less appropriate depending on how it's used, but then at
least wouldn't require configuration, and could always be referred to by
name.


On Wed, Aug 20, 2014 at 10:15 AM, Gustavo Niemeyer <gust...@niemeyer.net>
wrote:

> On Wed, Aug 20, 2014 at 11:08 AM, William Reade
> <william.re...@canonical.com> wrote:
> > On Wed, Aug 20, 2014 at 10:46 AM, Matthew Williams
> > <matthew.willi...@canonical.com> wrote:
> >> 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?
> >
> >
> > I'm pretty much adamant that we shouldn't even run new hooks, or expose
> new
> > tools, unless the charm explicitly declares it knows about them. But I do
> > imagine that many implementations will want the else anyway: they don't
> need
> > to provide an implementation for every single hook anyway.
>
> But we're talking about "default-hook", which is supposed to run when
> things are missing?  Actually, we should probably call this
> "missing-hook" as originally suggested, to make it more obvious that
> this is being called because some arbitrary hook was not found. It'll
> probably convey the importance handling unknowns in a sane way more
> clearly.
>
>
> 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
>
-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev

Reply via email to