Merge lp:~hopem/charms/trusty/neutron-api/pki-token-support into lp:~openstack-charmers-archive/charms/trusty/neutron-api/next
- Trusty Tahr (14.04)
- pki-token-support
- Merge into next
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 84 | ||||
Proposed branch: | lp:~hopem/charms/trusty/neutron-api/pki-token-support | ||||
Merge into: | lp:~openstack-charmers-archive/charms/trusty/neutron-api/next | ||||
Diff against target: |
465 lines (+244/-24) 14 files modified
hooks/charmhelpers/contrib/charmsupport/nrpe.py (+41/-7) hooks/charmhelpers/contrib/hahelpers/cluster.py (+5/-1) hooks/charmhelpers/contrib/openstack/amulet/deployment.py (+5/-2) hooks/charmhelpers/contrib/openstack/context.py (+26/-9) hooks/charmhelpers/contrib/openstack/files/__init__.py (+18/-0) hooks/charmhelpers/contrib/openstack/files/check_haproxy.sh (+32/-0) hooks/charmhelpers/contrib/openstack/files/check_haproxy_queue_depth.sh (+30/-0) hooks/charmhelpers/contrib/openstack/ip.py (+37/-0) hooks/charmhelpers/contrib/openstack/utils.py (+1/-0) hooks/charmhelpers/core/fstab.py (+2/-2) hooks/charmhelpers/core/strutils.py (+42/-0) hooks/neutron_api_utils.py (+3/-1) templates/icehouse/neutron.conf (+1/-1) templates/kilo/neutron.conf (+1/-1) |
||||
To merge this branch: | bzr merge lp:~hopem/charms/trusty/neutron-api/pki-token-support | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Liam Young (community) | Approve | ||
Review via email: mp+250370@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 #1925 neutron-api-next for hopem mp250370
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #2044 neutron-api-next for hopem mp250370
AMULET FAIL: amulet-test missing
AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.
Full amulet test output: http://
Build: http://
- 82. By Edward Hope-Morley
-
synced /next
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #2209 neutron-api-next for hopem mp250370
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #1998 neutron-api-next for hopem mp250370
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #2155 neutron-api-next for hopem mp250370
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
ERROR subprocess encountered error code 1
make: *** [test] Error 1
Full amulet test output: http://
Build: http://
Preview Diff
1 | === modified file 'hooks/charmhelpers/contrib/charmsupport/nrpe.py' | |||
2 | --- hooks/charmhelpers/contrib/charmsupport/nrpe.py 2015-01-26 09:44:26 +0000 | |||
3 | +++ hooks/charmhelpers/contrib/charmsupport/nrpe.py 2015-02-24 11:59:09 +0000 | |||
4 | @@ -24,6 +24,8 @@ | |||
5 | 24 | import pwd | 24 | import pwd |
6 | 25 | import grp | 25 | import grp |
7 | 26 | import os | 26 | import os |
8 | 27 | import glob | ||
9 | 28 | import shutil | ||
10 | 27 | import re | 29 | import re |
11 | 28 | import shlex | 30 | import shlex |
12 | 29 | import yaml | 31 | import yaml |
13 | @@ -161,7 +163,7 @@ | |||
14 | 161 | log('Check command not found: {}'.format(parts[0])) | 163 | log('Check command not found: {}'.format(parts[0])) |
15 | 162 | return '' | 164 | return '' |
16 | 163 | 165 | ||
18 | 164 | def write(self, nagios_context, hostname, nagios_servicegroups=None): | 166 | def write(self, nagios_context, hostname, nagios_servicegroups): |
19 | 165 | nrpe_check_file = '/etc/nagios/nrpe.d/{}.cfg'.format( | 167 | nrpe_check_file = '/etc/nagios/nrpe.d/{}.cfg'.format( |
20 | 166 | self.command) | 168 | self.command) |
21 | 167 | with open(nrpe_check_file, 'w') as nrpe_check_config: | 169 | with open(nrpe_check_file, 'w') as nrpe_check_config: |
22 | @@ -177,14 +179,11 @@ | |||
23 | 177 | nagios_servicegroups) | 179 | nagios_servicegroups) |
24 | 178 | 180 | ||
25 | 179 | def write_service_config(self, nagios_context, hostname, | 181 | def write_service_config(self, nagios_context, hostname, |
27 | 180 | nagios_servicegroups=None): | 182 | nagios_servicegroups): |
28 | 181 | for f in os.listdir(NRPE.nagios_exportdir): | 183 | for f in os.listdir(NRPE.nagios_exportdir): |
29 | 182 | if re.search('.*{}.cfg'.format(self.command), f): | 184 | if re.search('.*{}.cfg'.format(self.command), f): |
30 | 183 | os.remove(os.path.join(NRPE.nagios_exportdir, f)) | 185 | os.remove(os.path.join(NRPE.nagios_exportdir, f)) |
31 | 184 | 186 | ||
32 | 185 | if not nagios_servicegroups: | ||
33 | 186 | nagios_servicegroups = nagios_context | ||
34 | 187 | |||
35 | 188 | templ_vars = { | 187 | templ_vars = { |
36 | 189 | 'nagios_hostname': hostname, | 188 | 'nagios_hostname': hostname, |
37 | 190 | 'nagios_servicegroup': nagios_servicegroups, | 189 | 'nagios_servicegroup': nagios_servicegroups, |
38 | @@ -211,10 +210,10 @@ | |||
39 | 211 | super(NRPE, self).__init__() | 210 | super(NRPE, self).__init__() |
40 | 212 | self.config = config() | 211 | self.config = config() |
41 | 213 | self.nagios_context = self.config['nagios_context'] | 212 | self.nagios_context = self.config['nagios_context'] |
43 | 214 | if 'nagios_servicegroups' in self.config: | 213 | if 'nagios_servicegroups' in self.config and self.config['nagios_servicegroups']: |
44 | 215 | self.nagios_servicegroups = self.config['nagios_servicegroups'] | 214 | self.nagios_servicegroups = self.config['nagios_servicegroups'] |
45 | 216 | else: | 215 | else: |
47 | 217 | self.nagios_servicegroups = 'juju' | 216 | self.nagios_servicegroups = self.nagios_context |
48 | 218 | self.unit_name = local_unit().replace('/', '-') | 217 | self.unit_name = local_unit().replace('/', '-') |
49 | 219 | if hostname: | 218 | if hostname: |
50 | 220 | self.hostname = hostname | 219 | self.hostname = hostname |
51 | @@ -322,3 +321,38 @@ | |||
52 | 322 | check_cmd='check_status_file.py -f ' | 321 | check_cmd='check_status_file.py -f ' |
53 | 323 | '/var/lib/nagios/service-check-%s.txt' % svc, | 322 | '/var/lib/nagios/service-check-%s.txt' % svc, |
54 | 324 | ) | 323 | ) |
55 | 324 | |||
56 | 325 | |||
57 | 326 | def copy_nrpe_checks(): | ||
58 | 327 | """ | ||
59 | 328 | Copy the nrpe checks into place | ||
60 | 329 | |||
61 | 330 | """ | ||
62 | 331 | NAGIOS_PLUGINS = '/usr/local/lib/nagios/plugins' | ||
63 | 332 | nrpe_files_dir = os.path.join(os.getenv('CHARM_DIR'), 'hooks', | ||
64 | 333 | 'charmhelpers', 'contrib', 'openstack', | ||
65 | 334 | 'files') | ||
66 | 335 | |||
67 | 336 | if not os.path.exists(NAGIOS_PLUGINS): | ||
68 | 337 | os.makedirs(NAGIOS_PLUGINS) | ||
69 | 338 | for fname in glob.glob(os.path.join(nrpe_files_dir, "check_*")): | ||
70 | 339 | if os.path.isfile(fname): | ||
71 | 340 | shutil.copy2(fname, | ||
72 | 341 | os.path.join(NAGIOS_PLUGINS, os.path.basename(fname))) | ||
73 | 342 | |||
74 | 343 | |||
75 | 344 | def add_haproxy_checks(nrpe, unit_name): | ||
76 | 345 | """ | ||
77 | 346 | Add checks for each service in list | ||
78 | 347 | |||
79 | 348 | :param NRPE nrpe: NRPE object to add check to | ||
80 | 349 | :param str unit_name: Unit name to use in check description | ||
81 | 350 | """ | ||
82 | 351 | nrpe.add_check( | ||
83 | 352 | shortname='haproxy_servers', | ||
84 | 353 | description='Check HAProxy {%s}' % unit_name, | ||
85 | 354 | check_cmd='check_haproxy.sh') | ||
86 | 355 | nrpe.add_check( | ||
87 | 356 | shortname='haproxy_queue', | ||
88 | 357 | description='Check HAProxy queue depth {%s}' % unit_name, | ||
89 | 358 | check_cmd='check_haproxy_queue_depth.sh') | ||
90 | 325 | 359 | ||
91 | === modified file 'hooks/charmhelpers/contrib/hahelpers/cluster.py' | |||
92 | --- hooks/charmhelpers/contrib/hahelpers/cluster.py 2015-01-26 09:44:26 +0000 | |||
93 | +++ hooks/charmhelpers/contrib/hahelpers/cluster.py 2015-02-24 11:59:09 +0000 | |||
94 | @@ -48,6 +48,9 @@ | |||
95 | 48 | from charmhelpers.core.decorators import ( | 48 | from charmhelpers.core.decorators import ( |
96 | 49 | retry_on_exception, | 49 | retry_on_exception, |
97 | 50 | ) | 50 | ) |
98 | 51 | from charmhelpers.core.strutils import ( | ||
99 | 52 | bool_from_string, | ||
100 | 53 | ) | ||
101 | 51 | 54 | ||
102 | 52 | 55 | ||
103 | 53 | class HAIncompleteConfig(Exception): | 56 | class HAIncompleteConfig(Exception): |
104 | @@ -164,7 +167,8 @@ | |||
105 | 164 | . | 167 | . |
106 | 165 | returns: boolean | 168 | returns: boolean |
107 | 166 | ''' | 169 | ''' |
109 | 167 | if config_get('use-https') == "yes": | 170 | use_https = config_get('use-https') |
110 | 171 | if use_https and bool_from_string(use_https): | ||
111 | 168 | return True | 172 | return True |
112 | 169 | if config_get('ssl_cert') and config_get('ssl_key'): | 173 | if config_get('ssl_cert') and config_get('ssl_key'): |
113 | 170 | return True | 174 | return True |
114 | 171 | 175 | ||
115 | === modified file 'hooks/charmhelpers/contrib/openstack/amulet/deployment.py' | |||
116 | --- hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-01-26 09:44:26 +0000 | |||
117 | +++ hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-02-24 11:59:09 +0000 | |||
118 | @@ -71,16 +71,19 @@ | |||
119 | 71 | services.append(this_service) | 71 | services.append(this_service) |
120 | 72 | use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph', | 72 | use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph', |
121 | 73 | 'ceph-osd', 'ceph-radosgw'] | 73 | 'ceph-osd', 'ceph-radosgw'] |
122 | 74 | # Openstack subordinate charms do not expose an origin option as that | ||
123 | 75 | # is controlled by the principle | ||
124 | 76 | ignore = ['neutron-openvswitch'] | ||
125 | 74 | 77 | ||
126 | 75 | if self.openstack: | 78 | if self.openstack: |
127 | 76 | for svc in services: | 79 | for svc in services: |
129 | 77 | if svc['name'] not in use_source: | 80 | if svc['name'] not in use_source + ignore: |
130 | 78 | config = {'openstack-origin': self.openstack} | 81 | config = {'openstack-origin': self.openstack} |
131 | 79 | self.d.configure(svc['name'], config) | 82 | self.d.configure(svc['name'], config) |
132 | 80 | 83 | ||
133 | 81 | if self.source: | 84 | if self.source: |
134 | 82 | for svc in services: | 85 | for svc in services: |
136 | 83 | if svc['name'] in use_source: | 86 | if svc['name'] in use_source and svc['name'] not in ignore: |
137 | 84 | config = {'source': self.source} | 87 | config = {'source': self.source} |
138 | 85 | self.d.configure(svc['name'], config) | 88 | self.d.configure(svc['name'], config) |
139 | 86 | 89 | ||
140 | 87 | 90 | ||
141 | === modified file 'hooks/charmhelpers/contrib/openstack/context.py' | |||
142 | --- hooks/charmhelpers/contrib/openstack/context.py 2015-01-26 09:44:26 +0000 | |||
143 | +++ hooks/charmhelpers/contrib/openstack/context.py 2015-02-24 11:59:09 +0000 | |||
144 | @@ -279,9 +279,25 @@ | |||
145 | 279 | class IdentityServiceContext(OSContextGenerator): | 279 | class IdentityServiceContext(OSContextGenerator): |
146 | 280 | interfaces = ['identity-service'] | 280 | interfaces = ['identity-service'] |
147 | 281 | 281 | ||
148 | 282 | def __init__(self, service=None, service_user=None): | ||
149 | 283 | self.service = service | ||
150 | 284 | self.service_user = service_user | ||
151 | 285 | |||
152 | 282 | def __call__(self): | 286 | def __call__(self): |
153 | 283 | log('Generating template context for identity-service', level=DEBUG) | 287 | log('Generating template context for identity-service', level=DEBUG) |
154 | 284 | ctxt = {} | 288 | ctxt = {} |
155 | 289 | |||
156 | 290 | if self.service and self.service_user: | ||
157 | 291 | # This is required for pki token signing if we don't want /tmp to | ||
158 | 292 | # be used. | ||
159 | 293 | cachedir = '/var/cache/%s' % (self.service) | ||
160 | 294 | if not os.path.isdir(cachedir): | ||
161 | 295 | log("Creating service cache dir %s" % (cachedir), level=DEBUG) | ||
162 | 296 | mkdir(path=cachedir, owner=self.service_user, | ||
163 | 297 | group=self.service_user, perms=0o700) | ||
164 | 298 | |||
165 | 299 | ctxt['signing_dir'] = cachedir | ||
166 | 300 | |||
167 | 285 | for rid in relation_ids('identity-service'): | 301 | for rid in relation_ids('identity-service'): |
168 | 286 | for unit in related_units(rid): | 302 | for unit in related_units(rid): |
169 | 287 | rdata = relation_get(rid=rid, unit=unit) | 303 | rdata = relation_get(rid=rid, unit=unit) |
170 | @@ -291,15 +307,16 @@ | |||
171 | 291 | auth_host = format_ipv6_addr(auth_host) or auth_host | 307 | auth_host = format_ipv6_addr(auth_host) or auth_host |
172 | 292 | svc_protocol = rdata.get('service_protocol') or 'http' | 308 | svc_protocol = rdata.get('service_protocol') or 'http' |
173 | 293 | auth_protocol = rdata.get('auth_protocol') or 'http' | 309 | auth_protocol = rdata.get('auth_protocol') or 'http' |
183 | 294 | ctxt = {'service_port': rdata.get('service_port'), | 310 | ctxt.update({'service_port': rdata.get('service_port'), |
184 | 295 | 'service_host': serv_host, | 311 | 'service_host': serv_host, |
185 | 296 | 'auth_host': auth_host, | 312 | 'auth_host': auth_host, |
186 | 297 | 'auth_port': rdata.get('auth_port'), | 313 | 'auth_port': rdata.get('auth_port'), |
187 | 298 | 'admin_tenant_name': rdata.get('service_tenant'), | 314 | 'admin_tenant_name': rdata.get('service_tenant'), |
188 | 299 | 'admin_user': rdata.get('service_username'), | 315 | 'admin_user': rdata.get('service_username'), |
189 | 300 | 'admin_password': rdata.get('service_password'), | 316 | 'admin_password': rdata.get('service_password'), |
190 | 301 | 'service_protocol': svc_protocol, | 317 | 'service_protocol': svc_protocol, |
191 | 302 | 'auth_protocol': auth_protocol} | 318 | 'auth_protocol': auth_protocol}) |
192 | 319 | |||
193 | 303 | if context_complete(ctxt): | 320 | if context_complete(ctxt): |
194 | 304 | # NOTE(jamespage) this is required for >= icehouse | 321 | # NOTE(jamespage) this is required for >= icehouse |
195 | 305 | # so a missing value just indicates keystone needs | 322 | # so a missing value just indicates keystone needs |
196 | 306 | 323 | ||
197 | === added directory 'hooks/charmhelpers/contrib/openstack/files' | |||
198 | === added file 'hooks/charmhelpers/contrib/openstack/files/__init__.py' | |||
199 | --- hooks/charmhelpers/contrib/openstack/files/__init__.py 1970-01-01 00:00:00 +0000 | |||
200 | +++ hooks/charmhelpers/contrib/openstack/files/__init__.py 2015-02-24 11:59:09 +0000 | |||
201 | @@ -0,0 +1,18 @@ | |||
202 | 1 | # Copyright 2014-2015 Canonical Limited. | ||
203 | 2 | # | ||
204 | 3 | # This file is part of charm-helpers. | ||
205 | 4 | # | ||
206 | 5 | # charm-helpers is free software: you can redistribute it and/or modify | ||
207 | 6 | # it under the terms of the GNU Lesser General Public License version 3 as | ||
208 | 7 | # published by the Free Software Foundation. | ||
209 | 8 | # | ||
210 | 9 | # charm-helpers is distributed in the hope that it will be useful, | ||
211 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
212 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
213 | 12 | # GNU Lesser General Public License for more details. | ||
214 | 13 | # | ||
215 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
216 | 15 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. | ||
217 | 16 | |||
218 | 17 | # dummy __init__.py to fool syncer into thinking this is a syncable python | ||
219 | 18 | # module | ||
220 | 0 | 19 | ||
221 | === added file 'hooks/charmhelpers/contrib/openstack/files/check_haproxy.sh' | |||
222 | --- hooks/charmhelpers/contrib/openstack/files/check_haproxy.sh 1970-01-01 00:00:00 +0000 | |||
223 | +++ hooks/charmhelpers/contrib/openstack/files/check_haproxy.sh 2015-02-24 11:59:09 +0000 | |||
224 | @@ -0,0 +1,32 @@ | |||
225 | 1 | #!/bin/bash | ||
226 | 2 | #-------------------------------------------- | ||
227 | 3 | # This file is managed by Juju | ||
228 | 4 | #-------------------------------------------- | ||
229 | 5 | # | ||
230 | 6 | # Copyright 2009,2012 Canonical Ltd. | ||
231 | 7 | # Author: Tom Haddon | ||
232 | 8 | |||
233 | 9 | CRITICAL=0 | ||
234 | 10 | NOTACTIVE='' | ||
235 | 11 | LOGFILE=/var/log/nagios/check_haproxy.log | ||
236 | 12 | AUTH=$(grep -r "stats auth" /etc/haproxy | head -1 | awk '{print $4}') | ||
237 | 13 | |||
238 | 14 | for appserver in $(grep ' server' /etc/haproxy/haproxy.cfg | awk '{print $2'}); | ||
239 | 15 | do | ||
240 | 16 | output=$(/usr/lib/nagios/plugins/check_http -a ${AUTH} -I 127.0.0.1 -p 8888 --regex="class=\"(active|backup)(2|3).*${appserver}" -e ' 200 OK') | ||
241 | 17 | if [ $? != 0 ]; then | ||
242 | 18 | date >> $LOGFILE | ||
243 | 19 | echo $output >> $LOGFILE | ||
244 | 20 | /usr/lib/nagios/plugins/check_http -a ${AUTH} -I 127.0.0.1 -p 8888 -v | grep $appserver >> $LOGFILE 2>&1 | ||
245 | 21 | CRITICAL=1 | ||
246 | 22 | NOTACTIVE="${NOTACTIVE} $appserver" | ||
247 | 23 | fi | ||
248 | 24 | done | ||
249 | 25 | |||
250 | 26 | if [ $CRITICAL = 1 ]; then | ||
251 | 27 | echo "CRITICAL:${NOTACTIVE}" | ||
252 | 28 | exit 2 | ||
253 | 29 | fi | ||
254 | 30 | |||
255 | 31 | echo "OK: All haproxy instances looking good" | ||
256 | 32 | exit 0 | ||
257 | 0 | 33 | ||
258 | === added file 'hooks/charmhelpers/contrib/openstack/files/check_haproxy_queue_depth.sh' | |||
259 | --- hooks/charmhelpers/contrib/openstack/files/check_haproxy_queue_depth.sh 1970-01-01 00:00:00 +0000 | |||
260 | +++ hooks/charmhelpers/contrib/openstack/files/check_haproxy_queue_depth.sh 2015-02-24 11:59:09 +0000 | |||
261 | @@ -0,0 +1,30 @@ | |||
262 | 1 | #!/bin/bash | ||
263 | 2 | #-------------------------------------------- | ||
264 | 3 | # This file is managed by Juju | ||
265 | 4 | #-------------------------------------------- | ||
266 | 5 | # | ||
267 | 6 | # Copyright 2009,2012 Canonical Ltd. | ||
268 | 7 | # Author: Tom Haddon | ||
269 | 8 | |||
270 | 9 | # These should be config options at some stage | ||
271 | 10 | CURRQthrsh=0 | ||
272 | 11 | MAXQthrsh=100 | ||
273 | 12 | |||
274 | 13 | AUTH=$(grep -r "stats auth" /etc/haproxy | head -1 | awk '{print $4}') | ||
275 | 14 | |||
276 | 15 | HAPROXYSTATS=$(/usr/lib/nagios/plugins/check_http -a ${AUTH} -I 127.0.0.1 -p 8888 -u '/;csv' -v) | ||
277 | 16 | |||
278 | 17 | for BACKEND in $(echo $HAPROXYSTATS| xargs -n1 | grep BACKEND | awk -F , '{print $1}') | ||
279 | 18 | do | ||
280 | 19 | CURRQ=$(echo "$HAPROXYSTATS" | grep $BACKEND | grep BACKEND | cut -d , -f 3) | ||
281 | 20 | MAXQ=$(echo "$HAPROXYSTATS" | grep $BACKEND | grep BACKEND | cut -d , -f 4) | ||
282 | 21 | |||
283 | 22 | if [[ $CURRQ -gt $CURRQthrsh || $MAXQ -gt $MAXQthrsh ]] ; then | ||
284 | 23 | echo "CRITICAL: queue depth for $BACKEND - CURRENT:$CURRQ MAX:$MAXQ" | ||
285 | 24 | exit 2 | ||
286 | 25 | fi | ||
287 | 26 | done | ||
288 | 27 | |||
289 | 28 | echo "OK: All haproxy queue depths looking good" | ||
290 | 29 | exit 0 | ||
291 | 30 | |||
292 | 0 | 31 | ||
293 | === modified file 'hooks/charmhelpers/contrib/openstack/ip.py' | |||
294 | --- hooks/charmhelpers/contrib/openstack/ip.py 2015-01-26 09:44:26 +0000 | |||
295 | +++ hooks/charmhelpers/contrib/openstack/ip.py 2015-02-24 11:59:09 +0000 | |||
296 | @@ -26,6 +26,8 @@ | |||
297 | 26 | ) | 26 | ) |
298 | 27 | from charmhelpers.contrib.hahelpers.cluster import is_clustered | 27 | from charmhelpers.contrib.hahelpers.cluster import is_clustered |
299 | 28 | 28 | ||
300 | 29 | from functools import partial | ||
301 | 30 | |||
302 | 29 | PUBLIC = 'public' | 31 | PUBLIC = 'public' |
303 | 30 | INTERNAL = 'int' | 32 | INTERNAL = 'int' |
304 | 31 | ADMIN = 'admin' | 33 | ADMIN = 'admin' |
305 | @@ -107,3 +109,38 @@ | |||
306 | 107 | "clustered=%s)" % (net_type, clustered)) | 109 | "clustered=%s)" % (net_type, clustered)) |
307 | 108 | 110 | ||
308 | 109 | return resolved_address | 111 | return resolved_address |
309 | 112 | |||
310 | 113 | |||
311 | 114 | def endpoint_url(configs, url_template, port, endpoint_type=PUBLIC, | ||
312 | 115 | override=None): | ||
313 | 116 | """Returns the correct endpoint URL to advertise to Keystone. | ||
314 | 117 | |||
315 | 118 | This method provides the correct endpoint URL which should be advertised to | ||
316 | 119 | the keystone charm for endpoint creation. This method allows for the url to | ||
317 | 120 | be overridden to force a keystone endpoint to have specific URL for any of | ||
318 | 121 | the defined scopes (admin, internal, public). | ||
319 | 122 | |||
320 | 123 | :param configs: OSTemplateRenderer config templating object to inspect | ||
321 | 124 | for a complete https context. | ||
322 | 125 | :param url_template: str format string for creating the url template. Only | ||
323 | 126 | two values will be passed - the scheme+hostname | ||
324 | 127 | returned by the canonical_url and the port. | ||
325 | 128 | :param endpoint_type: str endpoint type to resolve. | ||
326 | 129 | :param override: str the name of the config option which overrides the | ||
327 | 130 | endpoint URL defined by the charm itself. None will | ||
328 | 131 | disable any overrides (default). | ||
329 | 132 | """ | ||
330 | 133 | if override: | ||
331 | 134 | # Return any user-defined overrides for the keystone endpoint URL. | ||
332 | 135 | user_value = config(override) | ||
333 | 136 | if user_value: | ||
334 | 137 | return user_value.strip() | ||
335 | 138 | |||
336 | 139 | return url_template % (canonical_url(configs, endpoint_type), port) | ||
337 | 140 | |||
338 | 141 | |||
339 | 142 | public_endpoint = partial(endpoint_url, endpoint_type=PUBLIC) | ||
340 | 143 | |||
341 | 144 | internal_endpoint = partial(endpoint_url, endpoint_type=INTERNAL) | ||
342 | 145 | |||
343 | 146 | admin_endpoint = partial(endpoint_url, endpoint_type=ADMIN) | ||
344 | 110 | 147 | ||
345 | === modified file 'hooks/charmhelpers/contrib/openstack/utils.py' | |||
346 | --- hooks/charmhelpers/contrib/openstack/utils.py 2015-01-26 09:44:26 +0000 | |||
347 | +++ hooks/charmhelpers/contrib/openstack/utils.py 2015-02-24 11:59:09 +0000 | |||
348 | @@ -103,6 +103,7 @@ | |||
349 | 103 | ('2.1.0', 'juno'), | 103 | ('2.1.0', 'juno'), |
350 | 104 | ('2.2.0', 'juno'), | 104 | ('2.2.0', 'juno'), |
351 | 105 | ('2.2.1', 'kilo'), | 105 | ('2.2.1', 'kilo'), |
352 | 106 | ('2.2.2', 'kilo'), | ||
353 | 106 | ]) | 107 | ]) |
354 | 107 | 108 | ||
355 | 108 | DEFAULT_LOOPBACK_SIZE = '5G' | 109 | DEFAULT_LOOPBACK_SIZE = '5G' |
356 | 109 | 110 | ||
357 | === modified file 'hooks/charmhelpers/core/fstab.py' | |||
358 | --- hooks/charmhelpers/core/fstab.py 2015-02-17 07:10:15 +0000 | |||
359 | +++ hooks/charmhelpers/core/fstab.py 2015-02-24 11:59:09 +0000 | |||
360 | @@ -77,7 +77,7 @@ | |||
361 | 77 | for line in self.readlines(): | 77 | for line in self.readlines(): |
362 | 78 | line = line.decode('us-ascii') | 78 | line = line.decode('us-ascii') |
363 | 79 | try: | 79 | try: |
365 | 80 | if line.strip() and not line.startswith("#"): | 80 | if line.strip() and not line.strip().startswith("#"): |
366 | 81 | yield self._hydrate_entry(line) | 81 | yield self._hydrate_entry(line) |
367 | 82 | except ValueError: | 82 | except ValueError: |
368 | 83 | pass | 83 | pass |
369 | @@ -104,7 +104,7 @@ | |||
370 | 104 | 104 | ||
371 | 105 | found = False | 105 | found = False |
372 | 106 | for index, line in enumerate(lines): | 106 | for index, line in enumerate(lines): |
374 | 107 | if not line.startswith("#"): | 107 | if line.strip() and not line.strip().startswith("#"): |
375 | 108 | if self._hydrate_entry(line) == entry: | 108 | if self._hydrate_entry(line) == entry: |
376 | 109 | found = True | 109 | found = True |
377 | 110 | break | 110 | break |
378 | 111 | 111 | ||
379 | === added file 'hooks/charmhelpers/core/strutils.py' | |||
380 | --- hooks/charmhelpers/core/strutils.py 1970-01-01 00:00:00 +0000 | |||
381 | +++ hooks/charmhelpers/core/strutils.py 2015-02-24 11:59:09 +0000 | |||
382 | @@ -0,0 +1,42 @@ | |||
383 | 1 | #!/usr/bin/env python | ||
384 | 2 | # -*- coding: utf-8 -*- | ||
385 | 3 | |||
386 | 4 | # Copyright 2014-2015 Canonical Limited. | ||
387 | 5 | # | ||
388 | 6 | # This file is part of charm-helpers. | ||
389 | 7 | # | ||
390 | 8 | # charm-helpers is free software: you can redistribute it and/or modify | ||
391 | 9 | # it under the terms of the GNU Lesser General Public License version 3 as | ||
392 | 10 | # published by the Free Software Foundation. | ||
393 | 11 | # | ||
394 | 12 | # charm-helpers is distributed in the hope that it will be useful, | ||
395 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
396 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
397 | 15 | # GNU Lesser General Public License for more details. | ||
398 | 16 | # | ||
399 | 17 | # You should have received a copy of the GNU Lesser General Public License | ||
400 | 18 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. | ||
401 | 19 | |||
402 | 20 | import six | ||
403 | 21 | |||
404 | 22 | |||
405 | 23 | def bool_from_string(value): | ||
406 | 24 | """Interpret string value as boolean. | ||
407 | 25 | |||
408 | 26 | Returns True if value translates to True otherwise False. | ||
409 | 27 | """ | ||
410 | 28 | if isinstance(value, six.string_types): | ||
411 | 29 | value = six.text_type(value) | ||
412 | 30 | else: | ||
413 | 31 | msg = "Unable to interpret non-string value '%s' as boolean" % (value) | ||
414 | 32 | raise ValueError(msg) | ||
415 | 33 | |||
416 | 34 | value = value.strip().lower() | ||
417 | 35 | |||
418 | 36 | if value in ['y', 'yes', 'true', 't']: | ||
419 | 37 | return True | ||
420 | 38 | elif value in ['n', 'no', 'false', 'f']: | ||
421 | 39 | return False | ||
422 | 40 | |||
423 | 41 | msg = "Unable to interpret string value '%s' as boolean" % (value) | ||
424 | 42 | raise ValueError(msg) | ||
425 | 0 | 43 | ||
426 | === modified file 'hooks/neutron_api_utils.py' | |||
427 | --- hooks/neutron_api_utils.py 2015-02-17 11:43:13 +0000 | |||
428 | +++ hooks/neutron_api_utils.py 2015-02-24 11:59:09 +0000 | |||
429 | @@ -77,7 +77,9 @@ | |||
430 | 77 | database=config('database'), | 77 | database=config('database'), |
431 | 78 | ssl_dir=NEUTRON_CONF_DIR), | 78 | ssl_dir=NEUTRON_CONF_DIR), |
432 | 79 | context.PostgresqlDBContext(database=config('database')), | 79 | context.PostgresqlDBContext(database=config('database')), |
434 | 80 | neutron_api_context.IdentityServiceContext(), | 80 | neutron_api_context.IdentityServiceContext( |
435 | 81 | service='neutron', | ||
436 | 82 | service_user='neutron'), | ||
437 | 81 | neutron_api_context.NeutronCCContext(), | 83 | neutron_api_context.NeutronCCContext(), |
438 | 82 | context.SyslogContext(), | 84 | context.SyslogContext(), |
439 | 83 | context.BindHostContext(), | 85 | context.BindHostContext(), |
440 | 84 | 86 | ||
441 | === modified file 'templates/icehouse/neutron.conf' | |||
442 | --- templates/icehouse/neutron.conf 2014-10-22 16:31:29 +0000 | |||
443 | +++ templates/icehouse/neutron.conf 2015-02-24 11:59:09 +0000 | |||
444 | @@ -56,7 +56,7 @@ | |||
445 | 56 | root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf | 56 | root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf |
446 | 57 | 57 | ||
447 | 58 | [keystone_authtoken] | 58 | [keystone_authtoken] |
449 | 59 | signing_dir = /var/lib/neutron/keystone-signing | 59 | signing_dir = {{ signing_dir }} |
450 | 60 | {% if service_host -%} | 60 | {% if service_host -%} |
451 | 61 | service_protocol = {{ service_protocol }} | 61 | service_protocol = {{ service_protocol }} |
452 | 62 | service_host = {{ service_host }} | 62 | service_host = {{ service_host }} |
453 | 63 | 63 | ||
454 | === modified file 'templates/kilo/neutron.conf' | |||
455 | --- templates/kilo/neutron.conf 2015-01-20 14:15:55 +0000 | |||
456 | +++ templates/kilo/neutron.conf 2015-02-24 11:59:09 +0000 | |||
457 | @@ -56,7 +56,7 @@ | |||
458 | 56 | root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf | 56 | root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf |
459 | 57 | 57 | ||
460 | 58 | [keystone_authtoken] | 58 | [keystone_authtoken] |
462 | 59 | signing_dir = /var/lib/neutron/keystone-signing | 59 | signing_dir = {{ signing_dir }} |
463 | 60 | {% if service_host -%} | 60 | {% if service_host -%} |
464 | 61 | service_protocol = {{ service_protocol }} | 61 | service_protocol = {{ service_protocol }} |
465 | 62 | service_host = {{ service_host }} | 62 | service_host = {{ service_host }} |
charm_lint_check #2136 neutron-api-next for hopem mp250370
LINT OK: passed
Build: http:// 10.245. 162.77: 8080/job/ charm_lint_ check/2136/