First customer pain point pull request - default-hook

Gustavo Niemeyer gustavo.niemeyer at canonical.com
Mon Aug 18 18:57:50 UTC 2014


Rather than passing it as the first argument, I suggest introducing an
environment variable: $JUJU_HOOK_NAME. This would be set irrespective
of how the hook is being called, so that the same hook can be used
both as a symlink and as a default-hook, unchanged. It also means further
spawned processes get a chance to tell the context they're running under.

On Fri, Aug 15, 2014 at 5:36 PM, Nate Finch <nate.finch at canonical.com> wrote:
> Just wanted to let people know that Moonstone is ramping up on the customer
> pain points, even ahead of the full spec and prioritization.  I had talked
> to Jorge and Marco about what they thought was important, and they pointed
> out a couple of low hanging fruit.  This was one of them.
>
> Many charms these days only contain one real hook script, and the rest are
> all just symlinks to the real one.  (because no one wants to write 20
> scripts)  This is kind of a pain in the ass for charm writers, and doesn't
> work well on Windows (Windows symlink support is terrible).  So, why not
> just have a default hook that gets called if the real hook isn't there?
> That's what I implemented today:
>
> https://github.com/juju/juju/pull/528
>
> There's new hook in town: default-hook.  If it exists and a hook gets called
> that doesn't have a corresponding hook file, default-hook gets called with
> the name of the original hook as its first argument (arg[1]).
>
> That's it.
>
> If/when this PR is accepted, Marco is planning to update charmhelpers to
> make it automatically recognize when the default-hook is called, and get the
> hook name from arg[1] instead of arg[0], so current scripts wouldn't even
> need to change - they'd just need the new charmhelpers, rename the one true
> script to "default-hook", and delete all their symlinks.  Bam.
>
> Moonstone is very excited to be working to make Juju easier for charm
> developers, and we'll see more improvements coming next week.
>
> -Nate
>
> --
> Juju-dev mailing list
> Juju-dev at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju-dev
>



-- 
gustavo @ http://niemeyer.net



More information about the Juju-dev mailing list