Add dashboard-plugin relation
This commit is contained in:
commit
a054e1ee04
|
@ -0,0 +1 @@
|
|||
horizon_hooks.py
|
|
@ -24,6 +24,7 @@ from charmhelpers.contrib.openstack.utils import (
|
|||
config_value_changed,
|
||||
configure_installation_source,
|
||||
git_install_requested,
|
||||
git_pip_venv_dir,
|
||||
openstack_upgrade_available,
|
||||
os_release,
|
||||
save_script_rc
|
||||
|
@ -38,7 +39,8 @@ from horizon_utils import (
|
|||
do_openstack_upgrade,
|
||||
git_install,
|
||||
git_post_install_late,
|
||||
setup_ipv6
|
||||
setup_ipv6,
|
||||
INSTALL_DIR
|
||||
)
|
||||
from charmhelpers.contrib.network.ip import (
|
||||
get_iface_for_address,
|
||||
|
@ -244,6 +246,17 @@ def update_nrpe_config():
|
|||
nrpe_setup.write()
|
||||
|
||||
|
||||
@hooks.hook('dashboard-plugin-relation-joined')
|
||||
def update_dashboard_plugin(rel_id=None):
|
||||
if git_install_requested():
|
||||
bin_path = git_pip_venv_dir(config('openstack-origin-git'))
|
||||
else:
|
||||
bin_path = '/usr/bin'
|
||||
relation_set(relation_id=rel_id,
|
||||
bin_path=bin_path,
|
||||
openstack_dir=INSTALL_DIR)
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
hooks.execute(sys.argv)
|
||||
|
|
|
@ -91,6 +91,7 @@ APACHE_24_SSL = "%s/sites-available/default-ssl.conf" % (APACHE_CONF_DIR)
|
|||
APACHE_24_DEFAULT = "%s/sites-available/000-default.conf" % (APACHE_CONF_DIR)
|
||||
APACHE_SSL = "%s/sites-available/default-ssl" % (APACHE_CONF_DIR)
|
||||
APACHE_DEFAULT = "%s/sites-available/default" % (APACHE_CONF_DIR)
|
||||
INSTALL_DIR = "/usr/share/openstack-dashboard"
|
||||
ROUTER_SETTING = \
|
||||
"/usr/share/openstack-dashboard/openstack_dashboard/enabled/_40_router.py"
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ provides:
|
|||
scope: container
|
||||
website:
|
||||
interface: http
|
||||
dashboard-plugin:
|
||||
interface: dashboard-plugin
|
||||
requires:
|
||||
identity-service:
|
||||
interface: keystone
|
||||
|
|
|
@ -308,6 +308,30 @@ class TestHorizonHooks(CharmTestCase):
|
|||
self._call_hook('website-relation-joined')
|
||||
self.relation_set.assert_called_with(port=70, hostname='192.168.1.1')
|
||||
|
||||
@patch.object(hooks, 'git_install_requested')
|
||||
def test_dashboard_config_joined_not_git(self, _git_requested):
|
||||
_git_requested.return_value = False
|
||||
self._call_hook('dashboard-plugin-relation-joined')
|
||||
self.relation_set.assert_called_with(
|
||||
bin_path='/usr/bin',
|
||||
openstack_dir='/usr/share/openstack-dashboard',
|
||||
relation_id=None
|
||||
)
|
||||
|
||||
@patch.object(hooks, 'git_pip_venv_dir')
|
||||
@patch.object(hooks, 'git_install_requested')
|
||||
def test_dashboard_config_joined_git(self, _git_requested,
|
||||
_git_pip_venv_dir):
|
||||
expected_bin_path = '/mnt/fuji/venv'
|
||||
_git_requested.return_value = True
|
||||
_git_pip_venv_dir.return_value = expected_bin_path
|
||||
self._call_hook('dashboard-plugin-relation-joined')
|
||||
self.relation_set.assert_called_with(
|
||||
bin_path=expected_bin_path,
|
||||
openstack_dir='/usr/share/openstack-dashboard',
|
||||
relation_id=None
|
||||
)
|
||||
|
||||
@patch('sys.argv')
|
||||
@patch.object(hooks, 'install')
|
||||
def test_main_hook_exists(self, _install, _argv):
|
||||
|
|
Loading…
Reference in New Issue