我在 juju 2.0 (2.0-rc1-0ubuntu1~1) 和文档不谈太多细节。
我已经写了一个界面https://github.com/autonomouse/interface-weebl使用全局范围(或者我是这样认为的)。
我有 2 个 charm,并已在适当的提供/要求中将界面设置为“oildashboard”。
其中一个 charm 名为“weebl”,另一个用于测试的模拟 charm 名为“anti-weebl”。Anti-weebl 除了在其 juju 状态消息中显示传递给它的一条信息外,没有做太多事情,如下所示:
@when('oildashboard.available')
def display_data_in_status(oildashboard):
hookenv.status_set('active', oildashboard.weebl_username())
它昨天似乎还在工作,愉快地在 juju 状态中显示数据,但现在我已经将第二个关系涉及到来自 weebl 的第三个魅力,我得到了ValueError: Conversation with scope 'anti-weebl' not found
。
有人可以解释一下我在全球范围方面做错了什么吗?
这是完整的错误(在我unit-weebl-1: 14:54:29 INFO unit.weebl/1.oildashboard-relation-joined
从每一行的开头删除之后):
Traceback (most recent call last):
File "/var/lib/juju/agents/unit-weebl-1/charm/hooks/oildashboard-relation-joined", line 19, in <module>
main()
File "/usr/local/lib/python3.5/dist-packages/charms/reactive/__init__.py", line 78, in main
bus.dispatch()
File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 434, in dispatch
_invoke(other_handlers)
File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 417, in _invoke
handler.invoke()
File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 291, in invoke
self._action(*args)
File "/var/lib/juju/agents/unit-weebl-1/charm/reactive/weebl.py", line 52, in request_db
pgsql.set_remote('extensions', 'tablefunc')
File "/usr/local/lib/python3.5/dist-packages/charms/reactive/relations.py", line 323, in set_remote
self.conversation(scope).set_remote(key, value, data, **kwdata)
File "/usr/local/lib/python3.5/dist-packages/charms/reactive/relations.py", line 263, in conversation
raise ValueError("Conversation with scope '%s' not found" % scope)
ValueError: Conversation with scope 'anti-weebl' not found
unit-weebl-1: 14:54:29 ERROR juju.worker.uniter.operation hook "oildashboard-relation-joined" failed: exit status 1
unit-weebl-1: 14:54:29 INFO juju.worker.uniter awaiting error resolution for "relation-joined" hook
答案1
经过一番询问,结果发现这与范围无关!这实际上是因为我们set_remote(...)
在 charm 的其他地方使用了它,而它不应该在界面层之外使用。