Merge lp:~bac/charms/trusty/openstack-dashboard/dashboard-plugin into lp:~openstack-charmers-archive/charms/trusty/openstack-dashboard/next

Proposed by Brad Crittenden on 2015-09-04
Status: Merged
Merged at revision: 90
Proposed branch: lp:~bac/charms/trusty/openstack-dashboard/dashboard-plugin
Merge into: lp:~openstack-charmers-archive/charms/trusty/openstack-dashboard/next
Diff against target: 116 lines (+47/-6)
4 files modified
hooks/horizon_hooks.py (+12/-3)
hooks/horizon_utils.py (+1/-0)
metadata.yaml (+3/-3)
unit_tests/test_horizon_hooks.py (+31/-0)
To merge this branch: bzr merge lp:~bac/charms/trusty/openstack-dashboard/dashboard-plugin
Reviewer Review Type Date Requested Status
Liam Young 2015-09-04 Approve on 2015-10-06
Review via email: mp+270177@code.launchpad.net

Description of the change

This branch adds a new relation 'dashboard-plugin' for openstack-dashboard to communicate to subordinate plugin charms details about the installation so the plugin can insert itself.

Currently the two pieces of information sent via the relationship are bin_path and openstack_dir.

The bin_path can be different based on how openstack is installed by the charm. If installed via distro or cloud-archive, a debian package is used to install openstack and the system python libraries are modified. If installed via git source then a virtual environment is used. If a subordinate charm needs to install python packages via pip then it needs to know which pip to use. bin_path specifies the correct environment to use, either /usr/bin or the result of git_pip_venv_dir.

openstack_dir provides the path to where openstack is installed. Currently it is always /usr/share/openstack_dashboard. From that information the subordinate can figure out the path to local/enabled for adding dashboard enabling slugs (e.g. _50_mydashboard.py).

To post a comment you must log in.
83. By James Page on 2015-09-04

[trivial] Resync helpers to pickup liberty version detection

charm_lint_check #9387 openstack-dashboard-next for bac mp270177
    LINT FAIL: lint-test failed

LINT Results (max last 2 lines):
make: *** [lint] Error 1
ERROR:root:Make target returned non-zero.

Full lint test output: http://paste.ubuntu.com/12273326/
Build: http://10.245.162.77:8080/job/charm_lint_check/9387/

charm_unit_test #8682 openstack-dashboard-next for bac mp270177
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/8682/

charm_lint_check #9389 openstack-dashboard-next for bac mp270177
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/9389/

charm_unit_test #8684 openstack-dashboard-next for bac mp270177
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/8684/

charm_amulet_test #6251 openstack-dashboard-next for bac mp270177
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6251/

charm_amulet_test #6253 openstack-dashboard-next for bac mp270177
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6253/

84. By James Page on 2015-09-09

[1chb1n,r=james-page]

Update tests for T-K, V-K, prep for T-L and W-L. Clean up old lint. Resolve bug 1474030 race in svc restart checks.

85. By Brad Crittenden on 2015-09-10

Add dashboard-plugin relation

charm_lint_check #10965 openstack-dashboard-next for bac mp270177
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/10965/

charm_amulet_test #6858 openstack-dashboard-next for bac mp270177
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12606204/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6858/

charm_unit_test #10235 openstack-dashboard-next for bac mp270177
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/10235/

charm_lint_check #11025 openstack-dashboard-next for bac mp270177
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/11025/

charm_amulet_test #6874 openstack-dashboard-next for bac mp270177
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12612946/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6874/

Liam Young (gnuoy) wrote :

See inline comment

review: Needs Fixing

charm_lint_check #11091 openstack-dashboard-next for bac mp270177
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/11091/

charm_unit_test #10299 openstack-dashboard-next for bac mp270177
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/10299/

charm_amulet_test #6897 openstack-dashboard-next for bac mp270177
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 124
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12625976/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6897/

charm_lint_check #11097 openstack-dashboard-next for bac mp270177
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/11097/

charm_unit_test #10305 openstack-dashboard-next for bac mp270177
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/10305/

charm_amulet_test #6907 openstack-dashboard-next for bac mp270177
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 124
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12627583/
Build: http://10.245.162.77:8080/job/charm_amulet_test/6907/

charm_lint_check #11150 openstack-dashboard-next for bac mp270177
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/11150/

charm_unit_test #10355 openstack-dashboard-next for bac mp270177
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/10355/

charm_unit_test #10357 openstack-dashboard-next for bac mp270177
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/10357/

charm_lint_check #11155 openstack-dashboard-next for bac mp270177
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/11155/

charm_amulet_test #6927 openstack-dashboard-next for bac mp270177
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6927/

charm_amulet_test #6932 openstack-dashboard-next for bac mp270177
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6932/

charm_amulet_test #7030 openstack-dashboard-next for bac mp270177
    AMULET FAIL: amulet-test failed

AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.

Full amulet test output: http://paste.ubuntu.com/12645015/
Build: http://10.245.162.77:8080/job/charm_amulet_test/7030/

charm_lint_check #11329 openstack-dashboard-next for bac mp270177
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/11329/

charm_unit_test #10523 openstack-dashboard-next for bac mp270177
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/10523/

charm_amulet_test #7115 openstack-dashboard-next for bac mp270177
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/7115/

Brad Crittenden (bac) wrote :

Liam I have made the change you requested and now have all tests passing since the problem with CI was resolved. Please take another look and let me know how we can get this merged.

Liam Young (gnuoy) wrote :

approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/horizon_hooks.py'
2--- hooks/horizon_hooks.py 2015-09-24 16:32:05 +0000
3+++ hooks/horizon_hooks.py 2015-10-05 18:31:20 +0000
4@@ -24,6 +24,7 @@
5 config_value_changed,
6 configure_installation_source,
7 git_install_requested,
8+ git_pip_venv_dir,
9 openstack_upgrade_available,
10 os_release,
11 save_script_rc
12@@ -38,7 +39,8 @@
13 do_openstack_upgrade,
14 git_install,
15 git_post_install_late,
16- setup_ipv6
17+ setup_ipv6,
18+ INSTALL_DIR
19 )
20 from charmhelpers.contrib.network.ip import (
21 get_iface_for_address,
22@@ -245,8 +247,15 @@
23
24
25 @hooks.hook('dashboard-plugin-relation-joined')
26-def plugin_relation_joined():
27- relation_set(release=os_release("openstack-dashboard"))
28+def plugin_relation_joined(rel_id=None):
29+ if git_install_requested():
30+ bin_path = git_pip_venv_dir(config('openstack-origin-git'))
31+ else:
32+ bin_path = '/usr/bin'
33+ relation_set(release=os_release("openstack-dashboard"),
34+ relation_id=rel_id,
35+ bin_path=bin_path,
36+ openstack_dir=INSTALL_DIR)
37
38
39 @hooks.hook('dashboard-plugin-relation-changed')
40
41=== modified file 'hooks/horizon_utils.py'
42--- hooks/horizon_utils.py 2015-09-24 16:31:59 +0000
43+++ hooks/horizon_utils.py 2015-10-05 18:31:20 +0000
44@@ -91,6 +91,7 @@
45 APACHE_24_DEFAULT = "%s/sites-available/000-default.conf" % (APACHE_CONF_DIR)
46 APACHE_SSL = "%s/sites-available/default-ssl" % (APACHE_CONF_DIR)
47 APACHE_DEFAULT = "%s/sites-available/default" % (APACHE_CONF_DIR)
48+INSTALL_DIR = "/usr/share/openstack-dashboard"
49 ROUTER_SETTING = \
50 "/usr/share/openstack-dashboard/openstack_dashboard/enabled/_40_router.py"
51
52
53=== modified file 'metadata.yaml'
54--- metadata.yaml 2015-09-12 10:58:20 +0000
55+++ metadata.yaml 2015-10-05 18:31:20 +0000
56@@ -13,15 +13,15 @@
57 scope: container
58 website:
59 interface: http
60+ dashboard-plugin:
61+ interface: dashboard-plugin
62+ scope: container
63 requires:
64 identity-service:
65 interface: keystone
66 ha:
67 interface: hacluster
68 scope: container
69- dashboard-plugin:
70- interface: dashboard-plugin
71- scope: container
72 peers:
73 cluster:
74 interface: openstack-dashboard-ha
75
76=== modified file 'unit_tests/test_horizon_hooks.py'
77--- unit_tests/test_horizon_hooks.py 2015-08-27 15:02:34 +0000
78+++ unit_tests/test_horizon_hooks.py 2015-10-05 18:31:20 +0000
79@@ -308,6 +308,37 @@
80 self._call_hook('website-relation-joined')
81 self.relation_set.assert_called_with(port=70, hostname='192.168.1.1')
82
83+ @patch.object(hooks, 'os_release')
84+ @patch.object(hooks, 'git_install_requested')
85+ def test_dashboard_config_joined_not_git(
86+ self, _git_requested, _os_release):
87+ _git_requested.return_value = False
88+ _os_release.return_value = 'vivid'
89+ self._call_hook('dashboard-plugin-relation-joined')
90+ self.relation_set.assert_called_with(
91+ release='vivid',
92+ bin_path='/usr/bin',
93+ openstack_dir='/usr/share/openstack-dashboard',
94+ relation_id=None
95+ )
96+
97+ @patch.object(hooks, 'os_release')
98+ @patch.object(hooks, 'git_pip_venv_dir')
99+ @patch.object(hooks, 'git_install_requested')
100+ def test_dashboard_config_joined_git(
101+ self, _git_requested, _git_pip_venv_dir, _os_release):
102+ expected_bin_path = '/mnt/fuji/venv'
103+ _git_requested.return_value = True
104+ _git_pip_venv_dir.return_value = expected_bin_path
105+ _os_release.return_value = 'wily'
106+ self._call_hook('dashboard-plugin-relation-joined')
107+ self.relation_set.assert_called_with(
108+ release='wily',
109+ bin_path=expected_bin_path,
110+ openstack_dir='/usr/share/openstack-dashboard',
111+ relation_id=None
112+ )
113+
114 @patch('sys.argv')
115 @patch.object(hooks, 'install')
116 def test_main_hook_exists(self, _install, _argv):

Subscribers

People subscribed via source and target branches