Due to the bug [1] on OpenStack providers, unit.public_address doesn't actually work reliably. The fix [2] is only for the async function unit.get_public_address(). Sadly, zaza relied on unit.public_address and so it needs this patch for juju 2.9 support on OpenStack providers. This patch relies on an associated patch in zaza [3]; thus this will fails its tests until that passes. [1]: https://github.com/juju/python-libjuju/issues/551 [2]: https://github.com/juju/python-libjuju/pull/600 [3]: https://github.com/openstack-charmers/zaza/pull/468
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
# Copyright 2021 Canonical Ltd.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
"""Code for setting up Ceph Dashboard."""
|
|
|
|
import logging
|
|
|
|
import zaza.model
|
|
import zaza.openstack.utilities.openstack
|
|
|
|
|
|
def check_dashboard_cert(model_name=None):
|
|
"""Wait for Dashboard to be ready.
|
|
|
|
:param model_name: Name of model to query.
|
|
:type model_name: str
|
|
"""
|
|
logging.info("Check dashbaord Waiting for cacert")
|
|
zaza.openstack.utilities.openstack.block_until_ca_exists(
|
|
'ceph-dashboard',
|
|
'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(
|
|
zaza.model.get_unit_public_address(unit))
|
|
})
|