Merge lp:~james-page/charms/trusty/ceilometer/status-fixes-actions into lp:~openstack-charmers-archive/charms/trusty/ceilometer/next

Proposed by James Page on 2015-10-16
Status: Merged
Merged at revision: 103
Proposed branch: lp:~james-page/charms/trusty/ceilometer/status-fixes-actions
Merge into: lp:~openstack-charmers-archive/charms/trusty/ceilometer/next
Diff against target: 178 lines (+44/-13)
7 files modified
Makefile (+1/-1)
actions/actions.py (+17/-4)
actions/openstack_upgrade.py (+0/-1)
hooks/ceilometer_hooks.py (+2/-3)
lib/ceilometer_utils.py (+23/-2)
tests/basic_deployment.py (+1/-1)
unit_tests/test_actions_openstack_upgrade.py (+0/-1)
To merge this branch: bzr merge lp:~james-page/charms/trusty/ceilometer/status-fixes-actions
Reviewer Review Type Date Requested Status
Liam Young 2015-10-16 Approve on 2015-10-19
Review via email: mp+274699@code.launchpad.net
To post a comment you must log in.

charm_lint_check #12020 ceilometer-next for james-page mp274699
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/12020/

charm_unit_test #11171 ceilometer-next for james-page mp274699
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/11171/

charm_amulet_test #7382 ceilometer-next for james-page mp274699
    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://paste.ubuntu.com/12798238/
Build: http://10.245.162.77:8080/job/charm_amulet_test/7382/

104. By James Page on 2015-10-16

Tidy py files in root to lib folder, sort out import of hooks in actions

charm_lint_check #12021 ceilometer-next for james-page mp274699
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/12021/

charm_unit_test #11172 ceilometer-next for james-page mp274699
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/11172/

charm_amulet_test #7383 ceilometer-next for james-page mp274699
    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://paste.ubuntu.com/12798448/
Build: http://10.245.162.77:8080/job/charm_amulet_test/7383/

105. By James Page on 2015-10-16

update->flush

charm_lint_check #12022 ceilometer-next for james-page mp274699
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/12022/

charm_unit_test #11173 ceilometer-next for james-page mp274699
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/11173/

charm_amulet_test #7384 ceilometer-next for james-page mp274699
    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://paste.ubuntu.com/12798676/
Build: http://10.245.162.77:8080/job/charm_amulet_test/7384/

Ryan Beisner (1chb1n) wrote :

^ details from amulet test fail:
http://paste.ubuntu.com/12798703/

charm_lint_check #12023 ceilometer-next for james-page mp274699
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/12023/

charm_unit_test #11174 ceilometer-next for james-page mp274699
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/11174/

charm_amulet_test #7385 ceilometer-next for james-page mp274699
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/7385/

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 'Makefile'
2--- Makefile 2015-10-06 14:35:01 +0000
3+++ Makefile 2015-10-16 13:01:49 +0000
4@@ -3,7 +3,7 @@
5
6 lint:
7 @flake8 --exclude hooks/charmhelpers,tests/charmhelpers \
8- hooks unit_tests tests
9+ hooks unit_tests tests actions
10 @charm proof
11
12 test:
13
14=== modified file 'actions/actions.py'
15--- actions/actions.py 2015-09-16 08:26:05 +0000
16+++ actions/actions.py 2015-10-16 13:01:49 +0000
17@@ -5,7 +5,9 @@
18
19 from charmhelpers.core.host import service_pause, service_resume
20 from charmhelpers.core.hookenv import action_fail, status_set
21-from ceilometer_utils import CEILOMETER_SERVICES
22+from charmhelpers.core.unitdata import kv
23+from ceilometer_utils import CEILOMETER_SERVICES, assess_status
24+from ceilometer_hooks import CONFIGS
25
26
27 def pause(args):
28@@ -16,8 +18,15 @@
29 for service in CEILOMETER_SERVICES:
30 if not service_pause(service):
31 raise Exception("Failed to %s." % service)
32+
33+ db = kv()
34+ db.set('unit-paused', True)
35+ db.flush()
36+
37 status_set(
38- "maintenance", "Paused. Use 'resume' action to resume normal service.")
39+ "maintenance",
40+ "Unit paused - use 'resume' action to resume normal service")
41+
42
43 def resume(args):
44 """Resume the Ceilometer services.
45@@ -26,7 +35,12 @@
46 for service in CEILOMETER_SERVICES:
47 if not service_resume(service):
48 raise Exception("Failed to resume %s." % service)
49- status_set("active", "")
50+
51+ db = kv()
52+ db.set('unit-paused', False)
53+ db.flush()
54+
55+ assess_status(CONFIGS)
56
57
58 # A dictionary of all the defined actions to callables (which take
59@@ -49,4 +63,3 @@
60
61 if __name__ == "__main__":
62 sys.exit(main(sys.argv))
63-
64
65=== modified symlink 'actions/ceilometer_contexts.py'
66=== target changed u'../ceilometer_contexts.py' => u'../lib/ceilometer_contexts.py'
67=== added symlink 'actions/ceilometer_hooks.py'
68=== target is u'../hooks/ceilometer_hooks.py'
69=== modified symlink 'actions/ceilometer_utils.py'
70=== target changed u'../ceilometer_utils.py' => u'../lib/ceilometer_utils.py'
71=== modified file 'actions/openstack_upgrade.py'
72--- actions/openstack_upgrade.py 2015-09-22 21:01:13 +0000
73+++ actions/openstack_upgrade.py 2015-10-16 13:01:49 +0000
74@@ -1,6 +1,5 @@
75 #!/usr/bin/python
76 import sys
77-import uuid
78
79 sys.path.append('hooks/')
80
81
82=== modified symlink 'hooks/ceilometer_contexts.py'
83=== target changed u'../ceilometer_contexts.py' => u'../lib/ceilometer_contexts.py'
84=== modified file 'hooks/ceilometer_hooks.py'
85--- hooks/ceilometer_hooks.py 2015-10-10 22:55:54 +0000
86+++ hooks/ceilometer_hooks.py 2015-10-16 13:01:49 +0000
87@@ -28,7 +28,6 @@
88 from charmhelpers.contrib.openstack.utils import (
89 configure_installation_source,
90 openstack_upgrade_available,
91- set_os_workload_status,
92 )
93 from ceilometer_utils import (
94 get_packages,
95@@ -42,7 +41,7 @@
96 get_shared_secret,
97 do_openstack_upgrade,
98 set_shared_secret,
99- REQUIRED_INTERFACES,
100+ assess_status,
101 )
102 from ceilometer_contexts import CEILOMETER_PORT
103 from charmhelpers.contrib.openstack.ip import (
104@@ -339,4 +338,4 @@
105 hooks.execute(sys.argv)
106 except UnregisteredHookError as e:
107 log('Unknown hook {} - skipping.'.format(e))
108- set_os_workload_status(CONFIGS, REQUIRED_INTERFACES)
109\ No newline at end of file
110+ assess_status(CONFIGS)
111
112=== modified symlink 'hooks/ceilometer_utils.py'
113=== target changed u'../ceilometer_utils.py' => u'../lib/ceilometer_utils.py'
114=== added directory 'lib'
115=== renamed file 'ceilometer_contexts.py' => 'lib/ceilometer_contexts.py'
116=== renamed file 'ceilometer_utils.py' => 'lib/ceilometer_utils.py'
117--- ceilometer_utils.py 2015-10-10 22:42:31 +0000
118+++ lib/ceilometer_utils.py 2015-10-16 13:01:49 +0000
119@@ -17,9 +17,11 @@
120 from charmhelpers.contrib.openstack.utils import (
121 get_os_codename_package,
122 get_os_codename_install_source,
123- configure_installation_source
124+ configure_installation_source,
125+ set_os_workload_status,
126 )
127-from charmhelpers.core.hookenv import config, log
128+from charmhelpers.core.hookenv import config, log, status_set
129+from charmhelpers.core.unitdata import kv
130 from charmhelpers.fetch import apt_update, apt_install, apt_upgrade
131 from copy import deepcopy
132
133@@ -229,3 +231,22 @@
134 """
135 with open(SHARED_SECRET, 'w') as secret_file:
136 secret_file.write(secret)
137+
138+
139+def is_paused():
140+ '''Determine if current unit is in a paused state'''
141+ db = kv()
142+ if db.get('unit-paused'):
143+ return True
144+ else:
145+ return False
146+
147+
148+def assess_status(configs):
149+ if is_paused():
150+ status_set("maintenance",
151+ "Unit paused - use 'resume' action "
152+ "to resume normal service")
153+ return
154+
155+ set_os_workload_status(configs, REQUIRED_INTERFACES)
156
157=== modified file 'tests/basic_deployment.py'
158--- tests/basic_deployment.py 2015-09-10 20:54:44 +0000
159+++ tests/basic_deployment.py 2015-10-16 13:01:49 +0000
160@@ -604,7 +604,7 @@
161 unit_name = "ceilometer/0"
162 unit = self.d.sentry.unit[unit_name]
163
164- assert u.status_get(unit)[0] == "unknown"
165+ assert u.status_get(unit)[0] == "active"
166
167 action_id = self._run_action(unit_name, "pause")
168 assert self._wait_on_action(action_id), "Pause action failed."
169
170=== modified file 'unit_tests/test_actions_openstack_upgrade.py'
171--- unit_tests/test_actions_openstack_upgrade.py 2015-09-22 21:01:13 +0000
172+++ unit_tests/test_actions_openstack_upgrade.py 2015-10-16 13:01:49 +0000
173@@ -13,7 +13,6 @@
174 TO_PATCH = [
175 'config_changed',
176 'do_openstack_upgrade',
177- 'uuid'
178 ]
179
180

Subscribers

People subscribed via source and target branches