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
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 (community) Approve
Review via email: mp+232772@code.launchpad.net

Description of the change

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

Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/horizon_hooks.py'
--- hooks/horizon_hooks.py 2014-01-22 10:20:24 +0000
+++ hooks/horizon_hooks.py 2014-08-29 22:22:02 +0000
@@ -22,6 +22,7 @@
22from charmhelpers.contrib.openstack.utils import (22from charmhelpers.contrib.openstack.utils import (
23 configure_installation_source,23 configure_installation_source,
24 openstack_upgrade_available,24 openstack_upgrade_available,
25 os_release,
25 save_script_rc26 save_script_rc
26)27)
27from horizon_utils import (28from horizon_utils import (
@@ -44,7 +45,10 @@
44def install():45def install():
45 configure_installation_source(config('openstack-origin'))46 configure_installation_source(config('openstack-origin'))
46 apt_update(fatal=True)47 apt_update(fatal=True)
47 apt_install(filter_installed_packages(PACKAGES), fatal=True)48 packages = PACKAGES[:]
49 if os_release('openstack-dashboard') < 'icehouse':
50 packages += ['nodejs', 'node-less']
51 apt_install(filter_installed_packages(packages), fatal=True)
4852
4953
50@hooks.hook('upgrade-charm')54@hooks.hook('upgrade-charm')
5155
=== modified file 'hooks/horizon_utils.py'
--- hooks/horizon_utils.py 2014-05-21 10:06:19 +0000
+++ hooks/horizon_utils.py 2014-08-29 22:22:02 +0000
@@ -26,7 +26,7 @@
26PACKAGES = [26PACKAGES = [
27 "openstack-dashboard", "python-keystoneclient", "python-memcache",27 "openstack-dashboard", "python-keystoneclient", "python-memcache",
28 "memcached", "haproxy", "python-novaclient",28 "memcached", "haproxy", "python-novaclient",
29 "nodejs", "node-less", "openstack-dashboard-ubuntu-theme"29 "openstack-dashboard-ubuntu-theme"
30]30]
3131
32APACHE_CONF_DIR = "/etc/apache2"32APACHE_CONF_DIR = "/etc/apache2"
3333
=== 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-08-29 22:22:02 +0000
@@ -28,7 +28,8 @@
28 'unit_get',28 'unit_get',
29 'log',29 'log',
30 'execd_preinstall',30 'execd_preinstall',
31 'b64decode']31 'b64decode',
32 'os_release']
3233
3334
34def passthrough(value):35def passthrough(value):
@@ -48,11 +49,26 @@
4849
49 def test_install_hook(self):50 def test_install_hook(self):
50 self.filter_installed_packages.return_value = ['foo', 'bar']51 self.filter_installed_packages.return_value = ['foo', 'bar']
52 self.os_release.return_value = 'icehouse'
51 self._call_hook('install')53 self._call_hook('install')
52 self.configure_installation_source.assert_called_with('distro')54 self.configure_installation_source.assert_called_with('distro')
53 self.apt_update.assert_called_with(fatal=True)55 self.apt_update.assert_called_with(fatal=True)
54 self.apt_install.assert_called_with(['foo', 'bar'], fatal=True)56 self.apt_install.assert_called_with(['foo', 'bar'], fatal=True)
5557
58 def test_install_hook_icehouse_pkgs(self):
59 self.os_release.return_value = 'icehouse'
60 self._call_hook('install')
61 for pkg in ['nodejs', 'node-less']:
62 self.assertFalse(pkg in self.filter_installed_packages.call_args[0][0])
63 self.apt_install.assert_called()
64
65 def test_install_hook_pre_icehouse_pkgs(self):
66 self.os_release.return_value = 'grizzly'
67 self._call_hook('install')
68 for pkg in ['nodejs', 'node-less']:
69 self.assertTrue(pkg in self.filter_installed_packages.call_args[0][0])
70 self.apt_install.assert_called()
71
56 @patch('charmhelpers.core.host.file_hash')72 @patch('charmhelpers.core.host.file_hash')
57 @patch('charmhelpers.core.host.service')73 @patch('charmhelpers.core.host.service')
58 def test_upgrade_charm_hook(self, _service, _hash):74 def test_upgrade_charm_hook(self, _service, _hash):

Subscribers

People subscribed via source and target branches