From 23f95655b932713bfcfb74a3d9e1b852cfaf23b4 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Wed, 8 Sep 2021 17:44:11 +0000 Subject: [PATCH] Add setup method for setting grafana api for ceph dashboard --- .../charm_tests/ceph/dashboard/setup.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/zaza/openstack/charm_tests/ceph/dashboard/setup.py b/zaza/openstack/charm_tests/ceph/dashboard/setup.py index 7be7e7d..7a2488f 100644 --- a/zaza/openstack/charm_tests/ceph/dashboard/setup.py +++ b/zaza/openstack/charm_tests/ceph/dashboard/setup.py @@ -32,3 +32,20 @@ def check_dashboard_cert(model_name=None): 'CERTIFICATE', model_name=model_name) zaza.model.block_until_all_units_idle(model_name=model_name) + + +def set_grafana_url(model_name=None): + """Set the url for the grafana api. + + :param model_name: Name of model to query. + :type model_name: str + """ + try: + unit = zaza.model.get_units('grafana')[0] + except KeyError: + return + zaza.model.set_application_config( + 'ceph-dashboard', + { + 'grafana-api-url': "https://{}:3000".format( + unit.public_address)})