Closed johnsca closed 5 years ago
Upstream PR has been merged and released as an RC, but we should hold off on this PR until it's an official release.
@stub Would you mind testing this in a real world charm before I merge this?
The provides side seems to break because of PR #12. There is no relation_name
in the Endpoint class.
2018-06-12 09:18:31 ERROR juju-log Hook error:
Traceback (most recent call last):
File "/var/lib/juju/agents/unit-gateway-0/.venv/lib/python3.5/site-packages/charms/reactive/__init__.py", line 72, in main
bus.dispatch(restricted=restricted_mode)
File "/var/lib/juju/agents/unit-gateway-0/.venv/lib/python3.5/site-packages/charms/reactive/bus.py", line 375, in dispatch
_invoke(other_handlers)
File "/var/lib/juju/agents/unit-gateway-0/.venv/lib/python3.5/site-packages/charms/reactive/bus.py", line 351, in _invoke
handler.invoke()
File "/var/lib/juju/agents/unit-gateway-0/.venv/lib/python3.5/site-packages/charms/reactive/bus.py", line 173, in invoke
self._action(*args)
File "/var/lib/juju/agents/unit-gateway-0/charm/reactive/nginx-api-gateway.py", line 28, in configure_gateway
website.configure(port=config().get('port'))
File "/var/lib/juju/agents/unit-gateway-0/charm/hooks/relations/http/provides.py", line 33, in configure
hostname = self.get_ingress_address()
File "/var/lib/juju/agents/unit-gateway-0/charm/hooks/relations/http/provides.py", line 19, in get_ingress_address
network_info = hookenv.network_get(self.relation_name)
AttributeError: 'HttpProvides' object has no attribute 'relation_name'
@xannz Can you test this again?
The provides side seems fine but the require still has some issues.
https://github.com/juju-solutions/interface-http/blob/1946df11ac6c106029387324090721cc18db38e2/requires.py#L46-L48
This can not work since joined_units
keys are unit names and should probably become
private_address = relation.joined_units.received['private-address']
host = relation.joined_units.received['hostname'] or private_address
port = relation.joined_units.received['port']
@xannz Thanks. Fixed.
I would love to see this merged. Because the new reactive way is better, and the http layer is always used as an example. This should be a shining example.
:smiley:
Convert to use the Endpoint pattern from juju-solutions/charms.reactive#123
This shouldn't be merged until after that PR.