Zookeeper charm zkpeer-relation-changed issue.
Kevin Monroe
kevin.monroe at canonical.com
Tue Feb 27 17:58:11 UTC 2018
Hi Jose!
On Fri, Feb 23, 2018 at 8:53 AM, José Pekkarinen <
jose.pekkarinen at canonical.com> wrote:
>
> The issue I get when executing the hook is:
>
> # juju-run unit-zookeeper-0 hooks/zkpeer-relation-changed
> Running reactive_handler_main for cuda.sh (test)
> Nothing to invoke
> End reactive_handler_main (test)
> Traceback (most recent call last):
> File "hooks/zkpeer-relation-changed", line 19, in <module>
> main()
> File "/usr/local/lib/python3.5/dist-packages/charms/reactive/
> __init__.py",
> line 72, in main
> bus.dispatch(restricted=restricted_mode)
> File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py",
> line
> 367, in dispatch
> _invoke(hook_handlers)
> File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py",
> line
> 351, in _invoke
> handler.invoke()
> File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py",
> line
> 173, in invoke
> self._action(*args)
> TypeError: changed() missing 1 required positional argument: 'self'
>
> Which I presume it comes by the definition of
> check_cluster_changed, on the
> number of parameters, but I'm not that experienced with reactive charms to
> know. Can anyone shoot some thoughts on what the issue may be here?
>
>
The missing arg that it's complaining about happens because you're running
a relation hook without the relation context. You might have also noticed
that zk-peer-joined and -departed would fail in the same way. To do what
you want, you'll need to find the relation id for zkpeer:
$ sudo juju-run unit-zookeeper-0 'relation-ids zkpeer'
zkpeer:0
And then add the -r <id> option to your juju-run command:
$ sudo juju-run -r 0 unit-zookeeper-0 hooks/zkpeer-relation-joined
Running reactive_handler_main for cuda.sh (test)
Nothing to invoke
End reactive_handler_main (test)
Running reactive_handler_main for cuda.sh (test)
Will invoke: check_cuda_support
End reactive_handler_main (test)
Running reactive_handler_main for cuda.sh (invoke)
Invoking bash reactive handler: check_cuda_support
End reactive_handler_main (invoke)
Running reactive_handler_main for cuda.sh (test)
Nothing to invoke
End reactive_handler_main (test)
The -r will run your hook with the context from relation 0, which will be
the 'self' that was missing in your earlier attempt.
Hope that helps!
-Kevin
Thanks!
>
> José.
>
> --
> Bigdata mailing list
> Bigdata at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/
> mailman/listinfo/bigdata
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/bigdata/attachments/20180227/afb6477b/attachment.html>
More information about the Bigdata
mailing list