Merge lp:~corey.bryant/charms/trusty/keystone/action-managed-upgrade into lp:~openstack-charmers-archive/charms/trusty/keystone/next
- Trusty Tahr (14.04)
- action-managed-upgrade
- Merge into next
Status: | Merged |
---|---|
Merged at revision: | 187 |
Proposed branch: | lp:~corey.bryant/charms/trusty/keystone/action-managed-upgrade |
Merge into: | lp:~openstack-charmers-archive/charms/trusty/keystone/next |
Diff against target: |
188 lines (+139/-2) 6 files modified
actions.yaml (+4/-0) actions/openstack_upgrade.py (+37/-0) config.yaml (+10/-1) hooks/keystone_hooks.py (+1/-1) unit_tests/test_actions_openstack_upgrade.py (+56/-0) unit_tests/test_keystone_hooks.py (+31/-0) |
To merge this branch: | bzr merge lp:~corey.bryant/charms/trusty/keystone/action-managed-upgrade |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
David Ames (community) | Approve | ||
James Page | Needs Resubmitting | ||
Billy Olsen | Needs Fixing | ||
Review via email: mp+271143@code.launchpad.net |
Commit message
Description of the change
uosci-testing-bot (uosci-testing-bot) wrote : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #9217 keystone-next for corey.bryant mp271143
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #6437 keystone-next for corey.bryant mp271143
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://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #9224 keystone-next for corey.bryant mp271143
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #10060 keystone-next for corey.bryant mp271143
LINT OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #6447 keystone-next for corey.bryant mp271143
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://
Build: http://
Billy Olsen (billy-olsen) wrote : | # |
When I ran the upgrade action, I required a subsequent config-changed manual hook run in order to get the upgrade to work properly. The initial run of the openstack-ugprade action did upgrade all of the necessary packages, however the template rendering engine rendered kilo, then rendered icehouse templates (from which I was ugprading from). Digging into this a bit, I suspect its due to the way that the charmhelpers.
Billy Olsen (billy-olsen) wrote : | # |
Hmm, I see the same configs setting is on other MPs for the action ugprade as well, however they do *NOT* experience the kilo/icehouse/kilo issue. I think this warrants further investigation as to what specifically the root cause of this is.
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #10468 keystone-next for corey.bryant mp271143
LINT OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #9659 keystone-next for corey.bryant mp271143
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #6611 keystone-next for corey.bryant mp271143
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://
Build: http://
James Page (james-page) : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #10696 keystone-next for corey.bryant mp271143
LINT OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #9877 keystone-next for corey.bryant mp271143
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #6740 keystone-next for corey.bryant mp271143
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://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #6745 keystone-next for corey.bryant mp271143
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://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #6753 keystone-next for corey.bryant mp271143
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://
Build: http://
Corey Bryant (corey.bryant) wrote : | # |
Note that in my latest commit to this mp I reverted charm-helper changes to service_pause() and service_resume() which was causing amulet tests to fail. ack is looking into fixing those tests, but for now we should be ok merging this mp without those updates.
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #10775 keystone-next for corey.bryant mp271143
LINT OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #9952 keystone-next for corey.bryant mp271143
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #6780 keystone-next for corey.bryant mp271143
AMULET OK: passed
Build: http://
Corey Bryant (corey.bryant) wrote : | # |
In response to Billy's find above, we've moved all of the action-managed upgrade code to import CONFIGS instead of calling register_configs() (see commit #185 below). Having 2 calls to register_configs() was causing issues.
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #11539 keystone-next for corey.bryant mp271143
LINT OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #10731 keystone-next for corey.bryant mp271143
UNIT OK: passed
David Ames (thedac) wrote : | # |
Missing the openstack-upgrade symlink.
Still approved. I'll add the symlink at merge time.
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #7242 keystone-next for corey.bryant mp271143
AMULET OK: passed
Build: http://
Preview Diff
1 | === modified file 'actions.yaml' | |||
2 | --- actions.yaml 2015-08-28 06:58:11 +0000 | |||
3 | +++ actions.yaml 2015-10-07 16:21:02 +0000 | |||
4 | @@ -11,3 +11,7 @@ | |||
5 | 11 | Resume keystone services. | 11 | Resume keystone services. |
6 | 12 | If the keystone deployment is clustered using the hacluster charm, the | 12 | If the keystone deployment is clustered using the hacluster charm, the |
7 | 13 | corresponding hacluster unit on the node must be resumed as well. | 13 | corresponding hacluster unit on the node must be resumed as well. |
8 | 14 | openstack-upgrade: | ||
9 | 15 | description: | | ||
10 | 16 | Perform openstack upgrades. Config option action-managed-upgrade must be | ||
11 | 17 | set to True. | ||
12 | 14 | 18 | ||
13 | === added file 'actions/openstack_upgrade.py' | |||
14 | --- actions/openstack_upgrade.py 1970-01-01 00:00:00 +0000 | |||
15 | +++ actions/openstack_upgrade.py 2015-10-07 16:21:02 +0000 | |||
16 | @@ -0,0 +1,37 @@ | |||
17 | 1 | #!/usr/bin/python | ||
18 | 2 | import sys | ||
19 | 3 | |||
20 | 4 | sys.path.append('hooks/') | ||
21 | 5 | |||
22 | 6 | from charmhelpers.contrib.openstack.utils import ( | ||
23 | 7 | do_action_openstack_upgrade, | ||
24 | 8 | ) | ||
25 | 9 | |||
26 | 10 | from keystone_hooks import ( | ||
27 | 11 | config_changed, | ||
28 | 12 | CONFIGS, | ||
29 | 13 | ) | ||
30 | 14 | |||
31 | 15 | from keystone_utils import ( | ||
32 | 16 | do_openstack_upgrade, | ||
33 | 17 | ) | ||
34 | 18 | |||
35 | 19 | |||
36 | 20 | def openstack_upgrade(): | ||
37 | 21 | """Perform action-managed OpenStack upgrade. | ||
38 | 22 | |||
39 | 23 | Upgrades packages to the configured openstack-origin version and sets | ||
40 | 24 | the corresponding action status as a result. | ||
41 | 25 | |||
42 | 26 | If the charm was installed from source we cannot upgrade it. | ||
43 | 27 | For backwards compatibility a config flag (action-managed-upgrade) must | ||
44 | 28 | be set for this code to run, otherwise a full service level upgrade will | ||
45 | 29 | fire on config-changed.""" | ||
46 | 30 | |||
47 | 31 | if (do_action_openstack_upgrade('keystone', | ||
48 | 32 | do_openstack_upgrade, | ||
49 | 33 | CONFIGS)): | ||
50 | 34 | config_changed() | ||
51 | 35 | |||
52 | 36 | if __name__ == '__main__': | ||
53 | 37 | openstack_upgrade() | ||
54 | 0 | 38 | ||
55 | === modified file 'config.yaml' | |||
56 | --- config.yaml 2015-07-17 01:29:31 +0000 | |||
57 | +++ config.yaml 2015-10-07 16:21:02 +0000 | |||
58 | @@ -298,4 +298,13 @@ | |||
59 | 298 | description: | | 298 | description: | |
60 | 299 | A comma-separated list of nagios servicegroups. | 299 | A comma-separated list of nagios servicegroups. |
61 | 300 | If left empty, the nagios_context will be used as the servicegroup | 300 | If left empty, the nagios_context will be used as the servicegroup |
63 | 301 | 301 | action-managed-upgrade: | |
64 | 302 | type: boolean | ||
65 | 303 | default: False | ||
66 | 304 | description: | | ||
67 | 305 | If True enables openstack upgrades for this charm via juju actions. | ||
68 | 306 | You will still need to set openstack-origin to the new repository but | ||
69 | 307 | instead of an upgrade running automatically across all units, it will | ||
70 | 308 | wait for you to execute the openstack-upgrade action for this charm on | ||
71 | 309 | each unit. If False it will revert to existing behavior of upgrading | ||
72 | 310 | all units on config change. | ||
73 | 302 | 311 | ||
74 | === modified file 'hooks/keystone_hooks.py' | |||
75 | --- hooks/keystone_hooks.py 2015-09-30 07:01:00 +0000 | |||
76 | +++ hooks/keystone_hooks.py 2015-10-07 16:21:02 +0000 | |||
77 | @@ -153,7 +153,7 @@ | |||
78 | 153 | if config_value_changed('openstack-origin-git'): | 153 | if config_value_changed('openstack-origin-git'): |
79 | 154 | status_set('maintenance', 'Running Git install') | 154 | status_set('maintenance', 'Running Git install') |
80 | 155 | git_install(config('openstack-origin-git')) | 155 | git_install(config('openstack-origin-git')) |
82 | 156 | else: | 156 | elif not config('action-managed-upgrade'): |
83 | 157 | if openstack_upgrade_available('keystone'): | 157 | if openstack_upgrade_available('keystone'): |
84 | 158 | status_set('maintenance', 'Running openstack upgrade') | 158 | status_set('maintenance', 'Running openstack upgrade') |
85 | 159 | do_openstack_upgrade(configs=CONFIGS) | 159 | do_openstack_upgrade(configs=CONFIGS) |
86 | 160 | 160 | ||
87 | === added file 'unit_tests/test_actions_openstack_upgrade.py' | |||
88 | --- unit_tests/test_actions_openstack_upgrade.py 1970-01-01 00:00:00 +0000 | |||
89 | +++ unit_tests/test_actions_openstack_upgrade.py 2015-10-07 16:21:02 +0000 | |||
90 | @@ -0,0 +1,56 @@ | |||
91 | 1 | from mock import patch | ||
92 | 2 | import os | ||
93 | 3 | |||
94 | 4 | os.environ['JUJU_UNIT_NAME'] = 'keystone' | ||
95 | 5 | |||
96 | 6 | with patch('keystone_utils.register_configs') as register_configs: | ||
97 | 7 | import openstack_upgrade | ||
98 | 8 | import keystone_hooks as hooks | ||
99 | 9 | |||
100 | 10 | from test_utils import ( | ||
101 | 11 | CharmTestCase | ||
102 | 12 | ) | ||
103 | 13 | |||
104 | 14 | TO_PATCH = [ | ||
105 | 15 | 'config_changed', | ||
106 | 16 | 'do_openstack_upgrade', | ||
107 | 17 | ] | ||
108 | 18 | |||
109 | 19 | |||
110 | 20 | class TestCinderUpgradeActions(CharmTestCase): | ||
111 | 21 | |||
112 | 22 | def setUp(self): | ||
113 | 23 | super(TestCinderUpgradeActions, self).setUp(openstack_upgrade, | ||
114 | 24 | TO_PATCH) | ||
115 | 25 | |||
116 | 26 | @patch.object(hooks, 'register_configs') | ||
117 | 27 | @patch('charmhelpers.contrib.openstack.utils.config') | ||
118 | 28 | @patch('charmhelpers.contrib.openstack.utils.action_set') | ||
119 | 29 | @patch('charmhelpers.contrib.openstack.utils.git_install_requested') | ||
120 | 30 | @patch('charmhelpers.contrib.openstack.utils.openstack_upgrade_available') | ||
121 | 31 | def test_openstack_upgrade_true(self, upgrade_avail, git_requested, | ||
122 | 32 | action_set, config, reg_configs): | ||
123 | 33 | git_requested.return_value = False | ||
124 | 34 | upgrade_avail.return_value = True | ||
125 | 35 | config.return_value = True | ||
126 | 36 | |||
127 | 37 | openstack_upgrade.openstack_upgrade() | ||
128 | 38 | |||
129 | 39 | self.assertTrue(self.do_openstack_upgrade.called) | ||
130 | 40 | self.assertTrue(self.config_changed.called) | ||
131 | 41 | |||
132 | 42 | @patch.object(hooks, 'register_configs') | ||
133 | 43 | @patch('charmhelpers.contrib.openstack.utils.config') | ||
134 | 44 | @patch('charmhelpers.contrib.openstack.utils.action_set') | ||
135 | 45 | @patch('charmhelpers.contrib.openstack.utils.git_install_requested') | ||
136 | 46 | @patch('charmhelpers.contrib.openstack.utils.openstack_upgrade_available') | ||
137 | 47 | def test_openstack_upgrade_false(self, upgrade_avail, git_requested, | ||
138 | 48 | action_set, config, reg_configs): | ||
139 | 49 | git_requested.return_value = False | ||
140 | 50 | upgrade_avail.return_value = True | ||
141 | 51 | config.return_value = False | ||
142 | 52 | |||
143 | 53 | openstack_upgrade.openstack_upgrade() | ||
144 | 54 | |||
145 | 55 | self.assertFalse(self.do_openstack_upgrade.called) | ||
146 | 56 | self.assertFalse(self.config_changed.called) | ||
147 | 0 | 57 | ||
148 | === modified file 'unit_tests/test_keystone_hooks.py' | |||
149 | --- unit_tests/test_keystone_hooks.py 2015-09-30 14:48:53 +0000 | |||
150 | +++ unit_tests/test_keystone_hooks.py 2015-10-07 16:21:02 +0000 | |||
151 | @@ -540,6 +540,37 @@ | |||
152 | 540 | self.assertFalse(self.openstack_upgrade_available.called) | 540 | self.assertFalse(self.openstack_upgrade_available.called) |
153 | 541 | self.assertFalse(self.do_openstack_upgrade.called) | 541 | self.assertFalse(self.do_openstack_upgrade.called) |
154 | 542 | 542 | ||
155 | 543 | @patch.object(hooks, 'git_install_requested') | ||
156 | 544 | @patch.object(hooks, 'config_value_changed') | ||
157 | 545 | @patch.object(hooks, 'ensure_ssl_dir') | ||
158 | 546 | @patch.object(hooks, 'configure_https') | ||
159 | 547 | @patch.object(hooks, 'is_pki_enabled') | ||
160 | 548 | @patch.object(hooks, 'is_ssl_cert_master') | ||
161 | 549 | @patch.object(hooks, 'peer_units') | ||
162 | 550 | @patch.object(unison, 'get_homedir') | ||
163 | 551 | @patch.object(unison, 'ensure_user') | ||
164 | 552 | @patch('keystone_utils.ensure_ssl_cert_master') | ||
165 | 553 | def test_config_changed_with_openstack_upgrade_action(self, | ||
166 | 554 | ensure_ssl_cert, | ||
167 | 555 | ensure_user, | ||
168 | 556 | get_home, | ||
169 | 557 | peer_units, is_ssl, | ||
170 | 558 | is_pki, config_https, | ||
171 | 559 | ensure_ssl_dir, | ||
172 | 560 | config_value_changed, | ||
173 | 561 | git_requested): | ||
174 | 562 | ensure_ssl_cert.return_value = False | ||
175 | 563 | is_pki.return_value = False | ||
176 | 564 | peer_units.return_value = [] | ||
177 | 565 | |||
178 | 566 | git_requested.return_value = False | ||
179 | 567 | self.openstack_upgrade_available.return_value = True | ||
180 | 568 | self.test_config.set('action-managed-upgrade', True) | ||
181 | 569 | |||
182 | 570 | hooks.config_changed() | ||
183 | 571 | |||
184 | 572 | self.assertFalse(self.do_openstack_upgrade.called) | ||
185 | 573 | |||
186 | 543 | @patch('keystone_utils.log') | 574 | @patch('keystone_utils.log') |
187 | 544 | @patch('keystone_utils.ensure_ssl_cert_master') | 575 | @patch('keystone_utils.ensure_ssl_cert_master') |
188 | 545 | @patch.object(hooks, 'hashlib') | 576 | @patch.object(hooks, 'hashlib') |
charm_lint_check #10050 keystone-next for corey.bryant mp271143
LINT OK: passed
Build: http:// 10.245. 162.77: 8080/job/ charm_lint_ check/10050/