Merge lp:~mwhudson/charms/trusty/openstack-dashboard/stable-no-node into lp:~openstack-charmers-archive/charms/trusty/openstack-dashboard/trunk

Proposed by Michael Hudson-Doyle on 2014-08-29
Status: Merged
Merged at revision: 34
Proposed branch: lp:~mwhudson/charms/trusty/openstack-dashboard/stable-no-node
Merge into: lp:~openstack-charmers-archive/charms/trusty/openstack-dashboard/trunk
Diff against target: 77 lines (+23/-3)
3 files modified
hooks/horizon_hooks.py (+5/-1)
hooks/horizon_utils.py (+1/-1)
unit_tests/test_horizon_hooks.py (+17/-1)
To merge this branch: bzr merge lp:~mwhudson/charms/trusty/openstack-dashboard/stable-no-node
Reviewer Review Type Date Requested Status
Liam Young 2014-08-29 Approve on 2014-09-01
Review via email: mp+232772@code.launchpad.net

Description of the change

To post a comment you must log in.
Liam Young (gnuoy) wrote :

Approved

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 2014-01-22 10:20:24 +0000
3+++ hooks/horizon_hooks.py 2014-08-29 22:22:02 +0000
4@@ -22,6 +22,7 @@
5 from charmhelpers.contrib.openstack.utils import (
6 configure_installation_source,
7 openstack_upgrade_available,
8+ os_release,
9 save_script_rc
10 )
11 from horizon_utils import (
12@@ -44,7 +45,10 @@
13 def install():
14 configure_installation_source(config('openstack-origin'))
15 apt_update(fatal=True)
16- apt_install(filter_installed_packages(PACKAGES), fatal=True)
17+ packages = PACKAGES[:]
18+ if os_release('openstack-dashboard') < 'icehouse':
19+ packages += ['nodejs', 'node-less']
20+ apt_install(filter_installed_packages(packages), fatal=True)
21
22
23 @hooks.hook('upgrade-charm')
24
25=== modified file 'hooks/horizon_utils.py'
26--- hooks/horizon_utils.py 2014-05-21 10:06:19 +0000
27+++ hooks/horizon_utils.py 2014-08-29 22:22:02 +0000
28@@ -26,7 +26,7 @@
29 PACKAGES = [
30 "openstack-dashboard", "python-keystoneclient", "python-memcache",
31 "memcached", "haproxy", "python-novaclient",
32- "nodejs", "node-less", "openstack-dashboard-ubuntu-theme"
33+ "openstack-dashboard-ubuntu-theme"
34 ]
35
36 APACHE_CONF_DIR = "/etc/apache2"
37
38=== modified file 'unit_tests/test_horizon_hooks.py'
39--- unit_tests/test_horizon_hooks.py 2014-04-10 16:19:57 +0000
40+++ unit_tests/test_horizon_hooks.py 2014-08-29 22:22:02 +0000
41@@ -28,7 +28,8 @@
42 'unit_get',
43 'log',
44 'execd_preinstall',
45- 'b64decode']
46+ 'b64decode',
47+ 'os_release']
48
49
50 def passthrough(value):
51@@ -48,11 +49,26 @@
52
53 def test_install_hook(self):
54 self.filter_installed_packages.return_value = ['foo', 'bar']
55+ self.os_release.return_value = 'icehouse'
56 self._call_hook('install')
57 self.configure_installation_source.assert_called_with('distro')
58 self.apt_update.assert_called_with(fatal=True)
59 self.apt_install.assert_called_with(['foo', 'bar'], fatal=True)
60
61+ def test_install_hook_icehouse_pkgs(self):
62+ self.os_release.return_value = 'icehouse'
63+ self._call_hook('install')
64+ for pkg in ['nodejs', 'node-less']:
65+ self.assertFalse(pkg in self.filter_installed_packages.call_args[0][0])
66+ self.apt_install.assert_called()
67+
68+ def test_install_hook_pre_icehouse_pkgs(self):
69+ self.os_release.return_value = 'grizzly'
70+ self._call_hook('install')
71+ for pkg in ['nodejs', 'node-less']:
72+ self.assertTrue(pkg in self.filter_installed_packages.call_args[0][0])
73+ self.apt_install.assert_called()
74+
75 @patch('charmhelpers.core.host.file_hash')
76 @patch('charmhelpers.core.host.service')
77 def test_upgrade_charm_hook(self, _service, _hash):

Subscribers

People subscribed via source and target branches