Merge lp:~hopem/charms/trusty/ceph-radosgw/lp1520339 into lp:~openstack-charmers-archive/charms/trusty/ceph-radosgw/next
- Trusty Tahr (14.04)
- lp1520339
- Merge into next
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~hopem/charms/trusty/ceph-radosgw/lp1520339 | ||||
Merge into: | lp:~openstack-charmers-archive/charms/trusty/ceph-radosgw/next | ||||
Diff against target: |
298 lines (+141/-11) 4 files modified
hooks/ceph_radosgw_context.py (+7/-0) hooks/hooks.py (+118/-5) templates/ceph.conf (+3/-1) unit_tests/test_hooks.py (+13/-5) |
||||
To merge this branch: | bzr merge lp:~hopem/charms/trusty/ceph-radosgw/lp1520339 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ryan Beisner (community) | Needs Fixing | ||
OpenStack Charmers | Pending | ||
Review via email:
|
This proposal has been superseded by a proposal from 2015-12-27.
Commit message
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #13702 ceph-radosgw-next for hopem mp279006
UNIT OK: passed
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8067 ceph-radosgw-next for hopem mp279006
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #15039 ceph-radosgw-next for hopem mp279006
LINT OK: passed
Build: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #14027 ceph-radosgw-next for hopem mp279006
UNIT OK: passed
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8204 ceph-radosgw-next for hopem mp279006
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ryan Beisner (1chb1n) wrote : | # |
FYI:
19:43:42 unit: ceph-radosgw/0: machine: 4 agent-state: error details: hook failed: "identity-
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8217 ceph-radosgw-next for hopem mp279006
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ryan Beisner (1chb1n) wrote : | # |
^ Just reconfirming hook error with 2nd run. Indeed:
19:43:42 unit: ceph-radosgw/0: machine: 4 agent-state: error details: hook failed: "identity-
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Edward Hope-Morley (hopem) wrote : | # |
@1chb1n this seems to be a dep issue i.e. for some reason python-six in that env is not compatible with python-
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ryan Beisner (1chb1n) wrote : | # |
@hopem, that message is from the juju unit, so all pkgs present are installed by either Juju or by the charm.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ryan Beisner (1chb1n) wrote : | # |
Here is the ceph-radosgw/0 unit log trace:
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #15771 ceph-radosgw-next for hopem mp279006
LINT OK: passed
Build: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #14719 ceph-radosgw-next for hopem mp279006
UNIT OK: passed
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8385 ceph-radosgw-next for hopem mp279006
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #15877 ceph-radosgw-next for hopem mp279006
LINT OK: passed
Build: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #14819 ceph-radosgw-next for hopem mp279006
UNIT OK: passed
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8387 ceph-radosgw-next for hopem mp279006
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #15878 ceph-radosgw-next for hopem mp279006
LINT OK: passed
Build: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #14820 ceph-radosgw-next for hopem mp279006
UNIT OK: passed
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8388 ceph-radosgw-next for hopem mp279006
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #16036 ceph-radosgw-next for hopem mp279006
LINT OK: passed
Build: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #14969 ceph-radosgw-next for hopem mp279006
UNIT OK: passed
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8390 ceph-radosgw-next for hopem mp279006
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://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #14970 ceph-radosgw-next for hopem mp279006
UNIT OK: passed
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #16037 ceph-radosgw-next for hopem mp279006
LINT OK: passed
Build: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8391 ceph-radosgw-next for hopem mp279006
AMULET OK: passed
Build: http://
- 52. By Edward Hope-Morley
-
[hopem,r=]
Configure rados gateway nss with CA and signing certs
from keystone so that it can decrypt revoked token
list from keystone.Partially-
Closes- Bug: 1520339
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #16090 ceph-radosgw-next for hopem mp279006
LINT OK: passed
Build: http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #15020 ceph-radosgw-next for hopem mp279006
UNIT OK: passed
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8392 ceph-radosgw-next for hopem mp279006
AMULET OK: passed
Build: http://
Unmerged revisions
Preview Diff
1 | === modified file 'hooks/ceph_radosgw_context.py' | |||
2 | --- hooks/ceph_radosgw_context.py 2015-11-26 16:20:26 +0000 | |||
3 | +++ hooks/ceph_radosgw_context.py 2015-12-27 00:21:39 +0000 | |||
4 | @@ -13,6 +13,7 @@ | |||
5 | 13 | relation_get, | 13 | relation_get, |
6 | 14 | unit_get, | 14 | unit_get, |
7 | 15 | ) | 15 | ) |
8 | 16 | import os | ||
9 | 16 | import socket | 17 | import socket |
10 | 17 | import dns.resolver | 18 | import dns.resolver |
11 | 18 | 19 | ||
12 | @@ -102,6 +103,12 @@ | |||
13 | 102 | 'loglevel': config('loglevel'), | 103 | 'loglevel': config('loglevel'), |
14 | 103 | } | 104 | } |
15 | 104 | 105 | ||
16 | 106 | certs_path = '/var/lib/ceph/nss' | ||
17 | 107 | paths = [os.path.join(certs_path, 'ca.pem'), | ||
18 | 108 | os.path.join(certs_path, 'signing_certificate.pem')] | ||
19 | 109 | if all([os.path.isfile(p) for p in paths]): | ||
20 | 110 | ctxt['cms'] = True | ||
21 | 111 | |||
22 | 105 | if self.context_complete(ctxt): | 112 | if self.context_complete(ctxt): |
23 | 106 | return ctxt | 113 | return ctxt |
24 | 107 | 114 | ||
25 | 108 | 115 | ||
26 | === modified file 'hooks/hooks.py' | |||
27 | --- hooks/hooks.py 2015-10-08 12:13:08 +0000 | |||
28 | +++ hooks/hooks.py 2015-12-27 00:21:39 +0000 | |||
29 | @@ -13,14 +13,19 @@ | |||
30 | 13 | import glob | 13 | import glob |
31 | 14 | import os | 14 | import os |
32 | 15 | import ceph | 15 | import ceph |
33 | 16 | |||
34 | 16 | from charmhelpers.core.hookenv import ( | 17 | from charmhelpers.core.hookenv import ( |
35 | 17 | relation_get, | 18 | relation_get, |
36 | 18 | relation_ids, | 19 | relation_ids, |
37 | 20 | related_units, | ||
38 | 19 | config, | 21 | config, |
39 | 20 | unit_get, | 22 | unit_get, |
40 | 21 | open_port, | 23 | open_port, |
41 | 22 | relation_set, | 24 | relation_set, |
43 | 23 | log, ERROR, | 25 | log, |
44 | 26 | DEBUG, | ||
45 | 27 | WARNING, | ||
46 | 28 | ERROR, | ||
47 | 24 | Hooks, UnregisteredHookError, | 29 | Hooks, UnregisteredHookError, |
48 | 25 | status_set, | 30 | status_set, |
49 | 26 | ) | 31 | ) |
50 | @@ -43,9 +48,11 @@ | |||
51 | 43 | REQUIRED_INTERFACES, | 48 | REQUIRED_INTERFACES, |
52 | 44 | check_optional_relations, | 49 | check_optional_relations, |
53 | 45 | ) | 50 | ) |
54 | 46 | |||
55 | 47 | from charmhelpers.payload.execd import execd_preinstall | 51 | from charmhelpers.payload.execd import execd_preinstall |
57 | 48 | from charmhelpers.core.host import cmp_pkgrevno | 52 | from charmhelpers.core.host import ( |
58 | 53 | cmp_pkgrevno, | ||
59 | 54 | mkdir, | ||
60 | 55 | ) | ||
61 | 49 | 56 | ||
62 | 50 | from charmhelpers.contrib.network.ip import ( | 57 | from charmhelpers.contrib.network.ip import ( |
63 | 51 | get_iface_for_address, | 58 | get_iface_for_address, |
64 | @@ -89,6 +96,11 @@ | |||
65 | 89 | 'radosgw', | 96 | 'radosgw', |
66 | 90 | 'ntp', | 97 | 'ntp', |
67 | 91 | 'haproxy', | 98 | 'haproxy', |
68 | 99 | 'libnss3-tools', | ||
69 | 100 | 'python-keystoneclient', | ||
70 | 101 | 'python-six', # Ensures correct version is installed for precise | ||
71 | 102 | # since python-keystoneclient does not pull in icehouse | ||
72 | 103 | # version | ||
73 | 92 | ] | 104 | ] |
74 | 93 | 105 | ||
75 | 94 | APACHE_PACKAGES = [ | 106 | APACHE_PACKAGES = [ |
76 | @@ -155,6 +167,99 @@ | |||
77 | 155 | shutil.copy('files/ports.conf', '/etc/apache2/ports.conf') | 167 | shutil.copy('files/ports.conf', '/etc/apache2/ports.conf') |
78 | 156 | 168 | ||
79 | 157 | 169 | ||
80 | 170 | def setup_keystone_certs(unit=None, rid=None): | ||
81 | 171 | """ | ||
82 | 172 | Get CA and signing certs from Keystone used to decrypt revoked token list. | ||
83 | 173 | """ | ||
84 | 174 | import requests | ||
85 | 175 | try: | ||
86 | 176 | # Kilo and newer | ||
87 | 177 | from keystoneclient.exceptions import ConnectionRefused | ||
88 | 178 | except ImportError: | ||
89 | 179 | # Juno and older | ||
90 | 180 | from keystoneclient.exceptions import ConnectionError as \ | ||
91 | 181 | ConnectionRefused | ||
92 | 182 | |||
93 | 183 | from keystoneclient.v2_0 import client | ||
94 | 184 | |||
95 | 185 | certs_path = '/var/lib/ceph/nss' | ||
96 | 186 | mkdir(certs_path) | ||
97 | 187 | |||
98 | 188 | rdata = relation_get(unit=unit, rid=rid) | ||
99 | 189 | auth_protocol = rdata.get('auth_protocol', 'http') | ||
100 | 190 | |||
101 | 191 | required_keys = ['admin_token', 'auth_host', 'auth_port'] | ||
102 | 192 | settings = {} | ||
103 | 193 | for key in required_keys: | ||
104 | 194 | settings[key] = rdata.get(key) | ||
105 | 195 | |||
106 | 196 | if not all(settings.values()): | ||
107 | 197 | log("Missing relation settings (%s) - skipping cert setup" % | ||
108 | 198 | (', '.join([k for k in settings.keys() if not settings[k]])), | ||
109 | 199 | level=DEBUG) | ||
110 | 200 | return | ||
111 | 201 | |||
112 | 202 | auth_endpoint = "%s://%s:%s/v2.0" % (auth_protocol, settings['auth_host'], | ||
113 | 203 | settings['auth_port']) | ||
114 | 204 | keystone = client.Client(token=settings['admin_token'], | ||
115 | 205 | endpoint=auth_endpoint) | ||
116 | 206 | |||
117 | 207 | # CA | ||
118 | 208 | try: | ||
119 | 209 | # Kilo and newer | ||
120 | 210 | ca_cert = keystone.certificates.get_ca_certificate() | ||
121 | 211 | except AttributeError: | ||
122 | 212 | # Juno and older | ||
123 | 213 | ca_cert = requests.request('GET', auth_endpoint + | ||
124 | 214 | '/certificates/ca').text | ||
125 | 215 | except ConnectionRefused: | ||
126 | 216 | log("Error connecting to keystone - skipping ca/signing cert setup", | ||
127 | 217 | level=WARNING) | ||
128 | 218 | return | ||
129 | 219 | |||
130 | 220 | if ca_cert: | ||
131 | 221 | log("Updating ca cert from keystone", level=DEBUG) | ||
132 | 222 | ca = os.path.join(certs_path, 'ca.pem') | ||
133 | 223 | with open(ca, 'w') as fd: | ||
134 | 224 | fd.write(ca_cert) | ||
135 | 225 | |||
136 | 226 | out = subprocess.check_output(['openssl', 'x509', '-in', ca, | ||
137 | 227 | '-pubkey']) | ||
138 | 228 | p = subprocess.Popen(['certutil', '-d', certs_path, '-A', '-n', 'ca', | ||
139 | 229 | '-t', 'TCu,Cu,Tuw'], stdin=subprocess.PIPE) | ||
140 | 230 | p.communicate(out) | ||
141 | 231 | else: | ||
142 | 232 | log("No ca cert available from keystone", level=DEBUG) | ||
143 | 233 | |||
144 | 234 | # Signing cert | ||
145 | 235 | try: | ||
146 | 236 | # Kilo and newer | ||
147 | 237 | signing_cert = keystone.certificates.get_signing_certificate() | ||
148 | 238 | except AttributeError: | ||
149 | 239 | # Juno and older | ||
150 | 240 | signing_cert = requests.request('GET', auth_endpoint + | ||
151 | 241 | '/certificates/signing').text | ||
152 | 242 | except ConnectionRefused: | ||
153 | 243 | log("Error connecting to keystone - skipping ca/signing cert setup", | ||
154 | 244 | level=WARNING) | ||
155 | 245 | return | ||
156 | 246 | |||
157 | 247 | if signing_cert: | ||
158 | 248 | log("Updating signing cert from keystone", level=DEBUG) | ||
159 | 249 | signing_cert_path = os.path.join(certs_path, 'signing_certificate.pem') | ||
160 | 250 | with open(signing_cert_path, 'w') as fd: | ||
161 | 251 | fd.write(signing_cert) | ||
162 | 252 | |||
163 | 253 | out = subprocess.check_output(['openssl', 'x509', '-in', | ||
164 | 254 | signing_cert_path, '-pubkey']) | ||
165 | 255 | p = subprocess.Popen(['certutil', '-A', '-d', certs_path, '-n', | ||
166 | 256 | 'signing_cert', '-t', 'P,P,P'], | ||
167 | 257 | stdin=subprocess.PIPE) | ||
168 | 258 | p.communicate(out) | ||
169 | 259 | else: | ||
170 | 260 | log("No signing cert available from keystone", level=DEBUG) | ||
171 | 261 | |||
172 | 262 | |||
173 | 158 | @hooks.hook('upgrade-charm', | 263 | @hooks.hook('upgrade-charm', |
174 | 159 | 'config-changed') | 264 | 'config-changed') |
175 | 160 | @restart_on_change({'/etc/ceph/ceph.conf': ['radosgw'], | 265 | @restart_on_change({'/etc/ceph/ceph.conf': ['radosgw'], |
176 | @@ -170,8 +275,9 @@ | |||
177 | 170 | apache_modules() | 275 | apache_modules() |
178 | 171 | apache_ports() | 276 | apache_ports() |
179 | 172 | apache_reload() | 277 | apache_reload() |
180 | 278 | |||
181 | 173 | for r_id in relation_ids('identity-service'): | 279 | for r_id in relation_ids('identity-service'): |
183 | 174 | identity_joined(relid=r_id) | 280 | identity_changed(relid=r_id) |
184 | 175 | 281 | ||
185 | 176 | 282 | ||
186 | 177 | @hooks.hook('mon-relation-departed', | 283 | @hooks.hook('mon-relation-departed', |
187 | @@ -225,10 +331,17 @@ | |||
188 | 225 | requested_roles=config('operator-roles'), | 331 | requested_roles=config('operator-roles'), |
189 | 226 | relation_id=relid) | 332 | relation_id=relid) |
190 | 227 | 333 | ||
191 | 334 | if relid: | ||
192 | 335 | for unit in related_units(relid): | ||
193 | 336 | setup_keystone_certs(unit=unit, rid=relid) | ||
194 | 337 | else: | ||
195 | 338 | setup_keystone_certs() | ||
196 | 339 | |||
197 | 228 | 340 | ||
198 | 229 | @hooks.hook('identity-service-relation-changed') | 341 | @hooks.hook('identity-service-relation-changed') |
199 | 230 | @restart_on_change({'/etc/ceph/ceph.conf': ['radosgw']}) | 342 | @restart_on_change({'/etc/ceph/ceph.conf': ['radosgw']}) |
201 | 231 | def identity_changed(): | 343 | def identity_changed(relid=None): |
202 | 344 | identity_joined(relid) | ||
203 | 232 | CONFIGS.write_all() | 345 | CONFIGS.write_all() |
204 | 233 | restart() | 346 | restart() |
205 | 234 | 347 | ||
206 | 235 | 348 | ||
207 | === modified file 'templates/ceph.conf' | |||
208 | --- templates/ceph.conf 2015-11-26 16:20:26 +0000 | |||
209 | +++ templates/ceph.conf 2015-12-27 00:21:39 +0000 | |||
210 | @@ -31,5 +31,7 @@ | |||
211 | 31 | rgw keystone token cache size = {{ cache_size }} | 31 | rgw keystone token cache size = {{ cache_size }} |
212 | 32 | rgw keystone revocation interval = {{ revocation_check_interval }} | 32 | rgw keystone revocation interval = {{ revocation_check_interval }} |
213 | 33 | rgw s3 auth use keystone = true | 33 | rgw s3 auth use keystone = true |
215 | 34 | #nss db path = /var/lib/ceph/nss | 34 | {% if cms -%} |
216 | 35 | nss db path = /var/lib/ceph/nss | ||
217 | 36 | {% endif %} | ||
218 | 35 | {% endif %} | 37 | {% endif %} |
219 | 36 | 38 | ||
220 | === modified file 'unit_tests/test_hooks.py' | |||
221 | --- unit_tests/test_hooks.py 2015-11-03 11:58:54 +0000 | |||
222 | +++ unit_tests/test_hooks.py 2015-12-27 00:21:39 +0000 | |||
223 | @@ -43,6 +43,7 @@ | |||
224 | 43 | 'relation_ids', | 43 | 'relation_ids', |
225 | 44 | 'relation_set', | 44 | 'relation_set', |
226 | 45 | 'relation_get', | 45 | 'relation_get', |
227 | 46 | 'related_units', | ||
228 | 46 | 'render_template', | 47 | 'render_template', |
229 | 47 | 'shutil', | 48 | 'shutil', |
230 | 48 | 'status_set', | 49 | 'status_set', |
231 | @@ -108,9 +109,8 @@ | |||
232 | 108 | self.add_source.assert_called_with('distro', 'secretkey') | 109 | self.add_source.assert_called_with('distro', 'secretkey') |
233 | 109 | self.assertTrue(self.apt_update.called) | 110 | self.assertTrue(self.apt_update.called) |
234 | 110 | self.assertFalse(_install_packages.called) | 111 | self.assertFalse(_install_packages.called) |
238 | 111 | self.apt_install.assert_called_with(['radosgw', | 112 | self.apt_install.assert_called_with(ceph_hooks.PACKAGES, |
239 | 112 | 'ntp', | 113 | fatal=True) |
237 | 113 | 'haproxy'], fatal=True) | ||
240 | 114 | self.apt_purge.assert_called_with(['libapache2-mod-fastcgi', | 114 | self.apt_purge.assert_called_with(['libapache2-mod-fastcgi', |
241 | 115 | 'apache2']) | 115 | 'apache2']) |
242 | 116 | 116 | ||
243 | @@ -167,6 +167,7 @@ | |||
244 | 167 | ] | 167 | ] |
245 | 168 | self.subprocess.call.assert_has_calls(calls) | 168 | self.subprocess.call.assert_has_calls(calls) |
246 | 169 | 169 | ||
247 | 170 | @patch.object(ceph_hooks, 'mkdir', lambda *args: None) | ||
248 | 170 | def test_config_changed(self): | 171 | def test_config_changed(self): |
249 | 171 | _install_packages = self.patch('install_packages') | 172 | _install_packages = self.patch('install_packages') |
250 | 172 | _emit_apacheconf = self.patch('emit_apacheconf') | 173 | _emit_apacheconf = self.patch('emit_apacheconf') |
251 | @@ -221,12 +222,15 @@ | |||
252 | 221 | cmd = ['service', 'radosgw', 'restart'] | 222 | cmd = ['service', 'radosgw', 'restart'] |
253 | 222 | self.subprocess.call.assert_called_with(cmd) | 223 | self.subprocess.call.assert_called_with(cmd) |
254 | 223 | 224 | ||
255 | 225 | @patch.object(ceph_hooks, 'setup_keystone_certs') | ||
256 | 224 | @patch('charmhelpers.contrib.openstack.ip.service_name', | 226 | @patch('charmhelpers.contrib.openstack.ip.service_name', |
257 | 225 | lambda *args: 'ceph-radosgw') | 227 | lambda *args: 'ceph-radosgw') |
258 | 226 | @patch('charmhelpers.contrib.openstack.ip.config') | 228 | @patch('charmhelpers.contrib.openstack.ip.config') |
260 | 227 | def test_identity_joined_early_version(self, _config): | 229 | def test_identity_joined_early_version(self, _config, |
261 | 230 | mock_setup_keystone_certs): | ||
262 | 228 | self.cmp_pkgrevno.return_value = -1 | 231 | self.cmp_pkgrevno.return_value = -1 |
263 | 229 | ceph_hooks.identity_joined() | 232 | ceph_hooks.identity_joined() |
264 | 233 | self.assertTrue(mock_setup_keystone_certs.called) | ||
265 | 230 | self.sys.exit.assert_called_with(1) | 234 | self.sys.exit.assert_called_with(1) |
266 | 231 | 235 | ||
267 | 232 | @patch('charmhelpers.contrib.openstack.ip.service_name', | 236 | @patch('charmhelpers.contrib.openstack.ip.service_name', |
268 | @@ -234,6 +238,7 @@ | |||
269 | 234 | @patch('charmhelpers.contrib.openstack.ip.resolve_address') | 238 | @patch('charmhelpers.contrib.openstack.ip.resolve_address') |
270 | 235 | @patch('charmhelpers.contrib.openstack.ip.config') | 239 | @patch('charmhelpers.contrib.openstack.ip.config') |
271 | 236 | def test_identity_joined(self, _config, _resolve_address): | 240 | def test_identity_joined(self, _config, _resolve_address): |
272 | 241 | self.related_units = ['unit/0'] | ||
273 | 237 | self.cmp_pkgrevno.return_value = 1 | 242 | self.cmp_pkgrevno.return_value = 1 |
274 | 238 | _resolve_address.return_value = 'myserv' | 243 | _resolve_address.return_value = 'myserv' |
275 | 239 | _config.side_effect = self.test_config.get | 244 | _config.side_effect = self.test_config.get |
276 | @@ -257,6 +262,7 @@ | |||
277 | 257 | @patch('charmhelpers.contrib.openstack.ip.config') | 262 | @patch('charmhelpers.contrib.openstack.ip.config') |
278 | 258 | def test_identity_joined_public_name(self, _config, _unit_get, | 263 | def test_identity_joined_public_name(self, _config, _unit_get, |
279 | 259 | _is_clustered): | 264 | _is_clustered): |
280 | 265 | self.related_units = ['unit/0'] | ||
281 | 260 | _config.side_effect = self.test_config.get | 266 | _config.side_effect = self.test_config.get |
282 | 261 | self.test_config.set('os-public-hostname', 'files.example.com') | 267 | self.test_config.set('os-public-hostname', 'files.example.com') |
283 | 262 | _unit_get.return_value = 'myserv' | 268 | _unit_get.return_value = 'myserv' |
284 | @@ -271,11 +277,13 @@ | |||
285 | 271 | relation_id='rid', | 277 | relation_id='rid', |
286 | 272 | admin_url='http://myserv:80/swift') | 278 | admin_url='http://myserv:80/swift') |
287 | 273 | 279 | ||
289 | 274 | def test_identity_changed(self): | 280 | @patch.object(ceph_hooks, 'identity_joined') |
290 | 281 | def test_identity_changed(self, mock_identity_joined): | ||
291 | 275 | _restart = self.patch('restart') | 282 | _restart = self.patch('restart') |
292 | 276 | ceph_hooks.identity_changed() | 283 | ceph_hooks.identity_changed() |
293 | 277 | self.CONFIGS.write_all.assert_called_with() | 284 | self.CONFIGS.write_all.assert_called_with() |
294 | 278 | self.assertTrue(_restart.called) | 285 | self.assertTrue(_restart.called) |
295 | 286 | self.assertTrue(mock_identity_joined.called) | ||
296 | 279 | 287 | ||
297 | 280 | @patch('charmhelpers.contrib.openstack.ip.is_clustered') | 288 | @patch('charmhelpers.contrib.openstack.ip.is_clustered') |
298 | 281 | @patch('charmhelpers.contrib.openstack.ip.unit_get') | 289 | @patch('charmhelpers.contrib.openstack.ip.unit_get') |
charm_lint_check #14695 ceph-radosgw-next for hopem mp279006
LINT OK: passed
Build: http:// 10.245. 162.77: 8080/job/ charm_lint_ check/14695/