gocharm help
Vasiliy Tolstov
v.tolstov at selfip.ru
Thu Apr 23 15:01:34 UTC 2015
2015-04-23 11:00 GMT+03:00 roger peppe <roger.peppe at canonical.com>:
> Nice start!
>
> As far as I can see the issue is just that there's
> a variant syntax of a relation that's allowed in the metadata
> (I replied in the issue itself).
>
> I had a brief look at your hooks.go file. I'd suggest that
> it's probably better to register the hooks individually,
> rather than using the switch (that way gocharm does the
> work).
>
> As it happens, the gocharm hook logic emits a log message
> anyway when a hook starts and finishes, but if you
> *do* want to wrap other generic logic around hooks, it's
> probably better to use a "decorator" style than to
> introduce the switch.
>
> e.g.
>
> func (n *mysql) registerHook(r *hook.Registry, name string, h
> func() error) {
> r.RegisterHook(name, func() error {
> n.ctxt.Logf("running %s", name)
> return h()
> })
> }
>
> ...
> n.registerHook(r, "install", n.install)
>
> Here's a paste of the code with a few suggested changes made:
>
> http://paste.ubuntu.com/10870074/
>
> Please let me know if you have any more issues (or, even better, if
> it all just works ok for you :-] )
Thanks for suggestions, i'm try to write simple wordpress charm and
check relations =)
Last question - what benefits of using simplerelation package or
writing own relations packages?
--
Vasiliy Tolstov,
e-mail: v.tolstov at selfip.ru
jabber: vase at selfip.ru
More information about the Juju-dev
mailing list