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

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 36
Proposed branch: lp:~mwhudson/charms/trusty/openstack-dashboard/no-node
Merge into: lp:~openstack-charmers-archive/charms/trusty/openstack-dashboard/next
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/no-node
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+227276@code.launchpad.net

Description of the change

This branch attempts to avoid installing nodejs and related things when it's not needed (which would let us deploy it on arm64). I haven't tested this _at all_, is there some standard way of doing this?

To post a comment you must log in.
Revision history for this message
Liam Young (gnuoy) wrote :

See inline comment

review: Needs Fixing
35. By Michael Hudson-Doyle

oops

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Hi, fixed I think.

Revision history for this message
Liam Young (gnuoy) wrote :

Looks good except the test_install_hook unit test is failing because os_release needs mocking out. I'd recommend also adding two additional tests to check that the packages are being adjusted correctly, one for pre-icehouse and one for icehouse. The icehouse could look something like:

=== modified file 'unit_tests/test_horizon_hooks.py'
--- unit_tests/test_horizon_hooks.py 2014-04-10 16:19:57 +0000
+++ unit_tests/test_horizon_hooks.py 2014-07-25 09:26:32 +0000
@@ -28,6 +28,7 @@
     'unit_get',
     'log',
     'execd_preinstall',
+ 'os_release',
     'b64decode']

@@ -53,6 +54,15 @@
         self.apt_update.assert_called_with(fatal=True)
         self.apt_install.assert_called_with(['foo', 'bar'], fatal=True)

+ def test_install_hook_icehouse_pkgs(self):
+ self.os_release.return_value = 'icehouse'
+ self._call_hook('install')
+ self.configure_installation_source.assert_called_with('distro')
+ self.apt_update.assert_called_with(fatal=True)
+ for pkg in ['nodejs', 'node-less']:
+ self.assertFalse(pkg in self.filter_installed_packages.call_args)
+ self.apt_install.assert_called()
+
     @patch('charmhelpers.core.host.file_hash')
     @patch('charmhelpers.core.host.service')
     def test_upgrade_charm_hook(self, _service, _hash):

review: Needs Fixing
36. By Michael Hudson-Doyle

update tests

37. By Michael Hudson-Doyle

merge trunk

38. By Michael Hudson-Doyle

merge next

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Hi, I finally got around to fixing this, I think. Please have another look!

Revision history for this message
Liam Young (gnuoy) wrote :

Approved and mwhudson has tested

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-27 03:51:21 +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-27 03:51:21 +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-27 03:51:21 +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