Merge lp:~james-page/charms/trusty/swift-storage/upgrade-fixes into lp:~openstack-charmers-archive/charms/trusty/swift-storage/next

Proposed by James Page
Status: Merged
Merged at revision: 47
Proposed branch: lp:~james-page/charms/trusty/swift-storage/upgrade-fixes
Merge into: lp:~openstack-charmers-archive/charms/trusty/swift-storage/next
Diff against target: 54 lines (+16/-1)
2 files modified
hooks/swift_storage_hooks.py (+10/-1)
unit_tests/test_swift_storage_relations.py (+6/-0)
To merge this branch: bzr merge lp:~james-page/charms/trusty/swift-storage/upgrade-fixes
Reviewer Review Type Date Requested Status
Corey Bryant (community) Approve
OpenStack Charmers Pending
Review via email: mp+237374@code.launchpad.net

Description of the change

Fixup upgrades

To post a comment you must log in.
Revision history for this message
Corey Bryant (corey.bryant) wrote :

+1

I tested upgrade-charm after manually removing python-psutil, and it gets installed as part of the upgrade. python-lint and unit_test also pass.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/swift_storage_hooks.py'
2--- hooks/swift_storage_hooks.py 2014-10-01 21:28:39 +0000
3+++ hooks/swift_storage_hooks.py 2014-10-07 08:51:19 +0000
4@@ -24,7 +24,11 @@
5 relation_set,
6 )
7
8-from charmhelpers.fetch import apt_install, apt_update
9+from charmhelpers.fetch import (
10+ apt_install,
11+ apt_update,
12+ filter_installed_packages
13+)
14 from charmhelpers.core.host import restart_on_change
15 from charmhelpers.payload.execd import execd_preinstall
16
17@@ -62,6 +66,11 @@
18 save_script_rc()
19
20
21+@hooks.hook('upgrade-charm')
22+def upgrade_charm():
23+ apt_install(filter_installed_packages(PACKAGES), fatal=True)
24+
25+
26 @hooks.hook()
27 def swift_storage_relation_joined():
28 devs = [os.path.basename(dev) for dev in determine_block_devices()]
29
30=== added symlink 'hooks/upgrade-charm'
31=== target is u'swift_storage_hooks.py'
32=== modified file 'unit_tests/test_swift_storage_relations.py'
33--- unit_tests/test_swift_storage_relations.py 2014-06-19 08:40:58 +0000
34+++ unit_tests/test_swift_storage_relations.py 2014-10-07 08:51:19 +0000
35@@ -24,6 +24,7 @@
36 # charmhelpers.core.host
37 'apt_update',
38 'apt_install',
39+ 'filter_installed_packages',
40 # charmehelpers.contrib.openstack.utils
41 'configure_installation_source',
42 'openstack_upgrade_available',
43@@ -71,6 +72,11 @@
44 self.assertTrue(self.do_openstack_upgrade.called)
45 self.assertTrue(self.CONFIGS.write_all.called)
46
47+ def test_upgrade_charm(self):
48+ self.filter_installed_packages.return_value = ['python-psutil']
49+ hooks.upgrade_charm()
50+ self.apt_install.assert_called_with(['python-psutil'], fatal=True)
51+
52 def test_storage_joined_single_device(self):
53 self.determine_block_devices.return_value = ['/dev/vdb']
54 hooks.swift_storage_relation_joined()

Subscribers

People subscribed via source and target branches