actions: retrieve dashboard URL
Allow sunbeam to retrieve the public ingress URL for the dashboard to avoid the user having to use juju commands to interrogate the model directly. Change-Id: Ia35f66ecfd282c70f329d955413fa26f464a08a2
This commit is contained in:
parent
ae4c56bacf
commit
be89e68454
@ -1,2 +1,2 @@
|
|||||||
# NOTE: no actions yet!
|
get-dashboard-url:
|
||||||
{ }
|
description: URL for access to the Horizon OpenStack Dashboard.
|
||||||
|
@ -84,6 +84,17 @@ class OpenstackDashboardOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm):
|
|||||||
"identity-credentials",
|
"identity-credentials",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def __init__(self, framework):
|
||||||
|
super().__init__(framework)
|
||||||
|
self.framework.observe(
|
||||||
|
self.on.get_dashboard_url_action,
|
||||||
|
self._get_dashboard_url_action,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _get_dashboard_url_action(self, event):
|
||||||
|
"""Retrieve the URL for the Horizon OpenStack Dashboard."""
|
||||||
|
event.set_results({"url": self.public_url})
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def default_public_ingress_port(self):
|
def default_public_ingress_port(self):
|
||||||
"""Default public ingress port."""
|
"""Default public ingress port."""
|
||||||
|
1
charms/horizon-k8s/tests/actions.yaml
Symbolic link
1
charms/horizon-k8s/tests/actions.yaml
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../actions.yaml
|
@ -110,3 +110,11 @@ class TestDashboardOperatorCharm(test_utils.CharmTestCase):
|
|||||||
self.check_file(
|
self.check_file(
|
||||||
"openstack-dashboard", "/etc/openstack-dashboard/local_settings.py"
|
"openstack-dashboard", "/etc/openstack-dashboard/local_settings.py"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_get_dashboard_url_action(self):
|
||||||
|
"""Test admin account action."""
|
||||||
|
action_event = mock.MagicMock()
|
||||||
|
self.harness.charm._get_dashboard_url_action(action_event)
|
||||||
|
action_event.set_results.assert_called_with(
|
||||||
|
{"url": "http://dashboard.juju:80"}
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user