Merge ~xavpaice/charm-openstack-service-checks/+git/charm-openstack-service-checks:ssl-certs into ~canonical-bootstack/charm-openstack-service-checks:master
- Git
- lp:~xavpaice/charm-openstack-service-checks/+git/charm-openstack-service-checks
- ssl-certs
- Merge into master
Proposed by
Xav Paice
Status: | Merged |
---|---|
Merge reported by: | Drew Freiberger |
Merged at revision: | d454eb66402a82caac3a1dd51d4e8eb1ea744c15 |
Proposed branch: | ~xavpaice/charm-openstack-service-checks/+git/charm-openstack-service-checks:ssl-certs |
Merge into: | ~canonical-bootstack/charm-openstack-service-checks:master |
Diff against target: |
342 lines (+299/-2) 3 files modified
config.yaml (+5/-1) icon.svg (+279/-0) reactive/service_checks.py (+15/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Legacy - Canonical WTFB | Pending | ||
Review via email: mp+332435@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 839ba06... by Xav Paice
-
remove option for ssl cert filename
- d454eb6... by Xav Paice
-
rename ssl var to be more accurate
Revision history for this message
Drew Freiberger (afreiberger) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/config.yaml b/config.yaml |
2 | index 5fef7f4..fbee527 100644 |
3 | --- a/config.yaml |
4 | +++ b/config.yaml |
5 | @@ -23,4 +23,8 @@ options: |
6 | description: | |
7 | A comma-separated list of nagios servicegroups. |
8 | If left empty, the nagios_context will be used as the servicegroup |
9 | - |
10 | + trusted_ssl_ca: |
11 | + type: string |
12 | + default: '' |
13 | + description: | |
14 | + base64 encoded SSL ca cert to use for OpenStack API client connections. |
15 | diff --git a/icon.svg b/icon.svg |
16 | new file mode 100644 |
17 | index 0000000..e092eef |
18 | --- /dev/null |
19 | +++ b/icon.svg |
20 | @@ -0,0 +1,279 @@ |
21 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
22 | +<!-- Created with Inkscape (http://www.inkscape.org/) --> |
23 | + |
24 | +<svg |
25 | + xmlns:dc="http://purl.org/dc/elements/1.1/" |
26 | + xmlns:cc="http://creativecommons.org/ns#" |
27 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
28 | + xmlns:svg="http://www.w3.org/2000/svg" |
29 | + xmlns="http://www.w3.org/2000/svg" |
30 | + xmlns:xlink="http://www.w3.org/1999/xlink" |
31 | + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
32 | + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
33 | + width="96" |
34 | + height="96" |
35 | + id="svg6517" |
36 | + version="1.1" |
37 | + inkscape:version="0.48+devel r12274" |
38 | + sodipodi:docname="Juju_charm_icon_template.svg"> |
39 | + <defs |
40 | + id="defs6519"> |
41 | + <linearGradient |
42 | + inkscape:collect="always" |
43 | + xlink:href="#Background" |
44 | + id="linearGradient6461" |
45 | + gradientUnits="userSpaceOnUse" |
46 | + x1="0" |
47 | + y1="970.29498" |
48 | + x2="144" |
49 | + y2="970.29498" |
50 | + gradientTransform="matrix(0,-0.66666669,0.6660448,0,-866.25992,731.29077)" /> |
51 | + <linearGradient |
52 | + id="Background"> |
53 | + <stop |
54 | + id="stop4178" |
55 | + offset="0" |
56 | + style="stop-color:#b8b8b8;stop-opacity:1" /> |
57 | + <stop |
58 | + id="stop4180" |
59 | + offset="1" |
60 | + style="stop-color:#c9c9c9;stop-opacity:1" /> |
61 | + </linearGradient> |
62 | + <filter |
63 | + style="color-interpolation-filters:sRGB;" |
64 | + inkscape:label="Inner Shadow" |
65 | + id="filter1121"> |
66 | + <feFlood |
67 | + flood-opacity="0.59999999999999998" |
68 | + flood-color="rgb(0,0,0)" |
69 | + result="flood" |
70 | + id="feFlood1123" /> |
71 | + <feComposite |
72 | + in="flood" |
73 | + in2="SourceGraphic" |
74 | + operator="out" |
75 | + result="composite1" |
76 | + id="feComposite1125" /> |
77 | + <feGaussianBlur |
78 | + in="composite1" |
79 | + stdDeviation="1" |
80 | + result="blur" |
81 | + id="feGaussianBlur1127" /> |
82 | + <feOffset |
83 | + dx="0" |
84 | + dy="2" |
85 | + result="offset" |
86 | + id="feOffset1129" /> |
87 | + <feComposite |
88 | + in="offset" |
89 | + in2="SourceGraphic" |
90 | + operator="atop" |
91 | + result="composite2" |
92 | + id="feComposite1131" /> |
93 | + </filter> |
94 | + <filter |
95 | + style="color-interpolation-filters:sRGB;" |
96 | + inkscape:label="Drop Shadow" |
97 | + id="filter950"> |
98 | + <feFlood |
99 | + flood-opacity="0.25" |
100 | + flood-color="rgb(0,0,0)" |
101 | + result="flood" |
102 | + id="feFlood952" /> |
103 | + <feComposite |
104 | + in="flood" |
105 | + in2="SourceGraphic" |
106 | + operator="in" |
107 | + result="composite1" |
108 | + id="feComposite954" /> |
109 | + <feGaussianBlur |
110 | + in="composite1" |
111 | + stdDeviation="1" |
112 | + result="blur" |
113 | + id="feGaussianBlur956" /> |
114 | + <feOffset |
115 | + dx="0" |
116 | + dy="1" |
117 | + result="offset" |
118 | + id="feOffset958" /> |
119 | + <feComposite |
120 | + in="SourceGraphic" |
121 | + in2="offset" |
122 | + operator="over" |
123 | + result="composite2" |
124 | + id="feComposite960" /> |
125 | + </filter> |
126 | + <clipPath |
127 | + clipPathUnits="userSpaceOnUse" |
128 | + id="clipPath873"> |
129 | + <g |
130 | + transform="matrix(0,-0.66666667,0.66604479,0,-258.25992,677.00001)" |
131 | + id="g875" |
132 | + inkscape:label="Layer 1" |
133 | + style="fill:#ff00ff;fill-opacity:1;stroke:none;display:inline"> |
134 | + <path |
135 | + style="fill:#ff00ff;fill-opacity:1;stroke:none;display:inline" |
136 | + d="m 46.702703,898.22775 50.594594,0 C 138.16216,898.22775 144,904.06497 144,944.92583 l 0,50.73846 c 0,40.86071 -5.83784,46.69791 -46.702703,46.69791 l -50.594594,0 C 5.8378378,1042.3622 0,1036.525 0,995.66429 L 0,944.92583 C 0,904.06497 5.8378378,898.22775 46.702703,898.22775 Z" |
137 | + id="path877" |
138 | + inkscape:connector-curvature="0" |
139 | + sodipodi:nodetypes="sssssssss" /> |
140 | + </g> |
141 | + </clipPath> |
142 | + <filter |
143 | + inkscape:collect="always" |
144 | + id="filter891" |
145 | + inkscape:label="Badge Shadow"> |
146 | + <feGaussianBlur |
147 | + inkscape:collect="always" |
148 | + stdDeviation="0.71999962" |
149 | + id="feGaussianBlur893" /> |
150 | + </filter> |
151 | + </defs> |
152 | + <sodipodi:namedview |
153 | + id="base" |
154 | + pagecolor="#ffffff" |
155 | + bordercolor="#666666" |
156 | + borderopacity="1.0" |
157 | + inkscape:pageopacity="0.0" |
158 | + inkscape:pageshadow="2" |
159 | + inkscape:zoom="4.0745362" |
160 | + inkscape:cx="18.514671" |
161 | + inkscape:cy="49.018169" |
162 | + inkscape:document-units="px" |
163 | + inkscape:current-layer="layer1" |
164 | + showgrid="true" |
165 | + fit-margin-top="0" |
166 | + fit-margin-left="0" |
167 | + fit-margin-right="0" |
168 | + fit-margin-bottom="0" |
169 | + inkscape:window-width="1920" |
170 | + inkscape:window-height="1029" |
171 | + inkscape:window-x="0" |
172 | + inkscape:window-y="24" |
173 | + inkscape:window-maximized="1" |
174 | + showborder="true" |
175 | + showguides="true" |
176 | + inkscape:guide-bbox="true" |
177 | + inkscape:showpageshadow="false"> |
178 | + <inkscape:grid |
179 | + type="xygrid" |
180 | + id="grid821" /> |
181 | + <sodipodi:guide |
182 | + orientation="1,0" |
183 | + position="16,48" |
184 | + id="guide823" /> |
185 | + <sodipodi:guide |
186 | + orientation="0,1" |
187 | + position="64,80" |
188 | + id="guide825" /> |
189 | + <sodipodi:guide |
190 | + orientation="1,0" |
191 | + position="80,40" |
192 | + id="guide827" /> |
193 | + <sodipodi:guide |
194 | + orientation="0,1" |
195 | + position="64,16" |
196 | + id="guide829" /> |
197 | + </sodipodi:namedview> |
198 | + <metadata |
199 | + id="metadata6522"> |
200 | + <rdf:RDF> |
201 | + <cc:Work |
202 | + rdf:about=""> |
203 | + <dc:format>image/svg+xml</dc:format> |
204 | + <dc:type |
205 | + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> |
206 | + <dc:title></dc:title> |
207 | + </cc:Work> |
208 | + </rdf:RDF> |
209 | + </metadata> |
210 | + <g |
211 | + inkscape:label="BACKGROUND" |
212 | + inkscape:groupmode="layer" |
213 | + id="layer1" |
214 | + transform="translate(268,-635.29076)" |
215 | + style="display:inline"> |
216 | + <path |
217 | + style="fill:url(#linearGradient6461);fill-opacity:1;stroke:none;display:inline;filter:url(#filter1121)" |
218 | + d="m -268,700.15563 0,-33.72973 c 0,-27.24324 3.88785,-31.13513 31.10302,-31.13513 l 33.79408,0 c 27.21507,0 31.1029,3.89189 31.1029,31.13513 l 0,33.72973 c 0,27.24325 -3.88783,31.13514 -31.1029,31.13514 l -33.79408,0 C -264.11215,731.29077 -268,727.39888 -268,700.15563 Z" |
219 | + id="path6455" |
220 | + inkscape:connector-curvature="0" |
221 | + sodipodi:nodetypes="sssssssss" /> |
222 | + </g> |
223 | + <g |
224 | + inkscape:groupmode="layer" |
225 | + id="layer3" |
226 | + inkscape:label="PLACE YOUR PICTOGRAM HERE" |
227 | + style="display:inline" /> |
228 | + <g |
229 | + inkscape:groupmode="layer" |
230 | + id="layer2" |
231 | + inkscape:label="BADGE" |
232 | + style="display:none" |
233 | + sodipodi:insensitive="true"> |
234 | + <g |
235 | + style="display:inline" |
236 | + transform="translate(-340.00001,-581)" |
237 | + id="g4394" |
238 | + clip-path="none"> |
239 | + <g |
240 | + id="g855"> |
241 | + <g |
242 | + inkscape:groupmode="maskhelper" |
243 | + id="g870" |
244 | + clip-path="url(#clipPath873)" |
245 | + style="opacity:0.6;filter:url(#filter891)"> |
246 | + <path |
247 | + transform="matrix(1.4999992,0,0,1.4999992,-29.999795,-237.54282)" |
248 | + d="m 264,552.36218 a 12,12 0 1 1 -24,0 A 12,12 0 1 1 264,552.36218 Z" |
249 | + sodipodi:ry="12" |
250 | + sodipodi:rx="12" |
251 | + sodipodi:cy="552.36218" |
252 | + sodipodi:cx="252" |
253 | + id="path844" |
254 | + style="color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" |
255 | + sodipodi:type="arc" /> |
256 | + </g> |
257 | + <g |
258 | + id="g862"> |
259 | + <path |
260 | + sodipodi:type="arc" |
261 | + style="color:#000000;fill:#f5f5f5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" |
262 | + id="path4398" |
263 | + sodipodi:cx="252" |
264 | + sodipodi:cy="552.36218" |
265 | + sodipodi:rx="12" |
266 | + sodipodi:ry="12" |
267 | + d="m 264,552.36218 a 12,12 0 1 1 -24,0 A 12,12 0 1 1 264,552.36218 Z" |
268 | + transform="matrix(1.4999992,0,0,1.4999992,-29.999795,-238.54282)" /> |
269 | + <path |
270 | + transform="matrix(1.25,0,0,1.25,33,-100.45273)" |
271 | + d="m 264,552.36218 a 12,12 0 1 1 -24,0 A 12,12 0 1 1 264,552.36218 Z" |
272 | + sodipodi:ry="12" |
273 | + sodipodi:rx="12" |
274 | + sodipodi:cy="552.36218" |
275 | + sodipodi:cx="252" |
276 | + id="path4400" |
277 | + style="color:#000000;fill:#dd4814;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" |
278 | + sodipodi:type="arc" /> |
279 | + <path |
280 | + sodipodi:type="star" |
281 | + style="color:#000000;fill:#f5f5f5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" |
282 | + id="path4459" |
283 | + sodipodi:sides="5" |
284 | + sodipodi:cx="666.19574" |
285 | + sodipodi:cy="589.50385" |
286 | + sodipodi:r1="7.2431178" |
287 | + sodipodi:r2="4.3458705" |
288 | + sodipodi:arg1="1.0471976" |
289 | + sodipodi:arg2="1.6755161" |
290 | + inkscape:flatsided="false" |
291 | + inkscape:rounded="0.1" |
292 | + inkscape:randomized="0" |
293 | + d="m 669.8173,595.77657 c -0.39132,0.22593 -3.62645,-1.90343 -4.07583,-1.95066 -0.44938,-0.0472 -4.05653,1.36297 -4.39232,1.06062 -0.3358,-0.30235 0.68963,-4.03715 0.59569,-4.47913 -0.0939,-0.44198 -2.5498,-3.43681 -2.36602,-3.8496 0.18379,-0.41279 4.05267,-0.59166 4.44398,-0.81759 0.39132,-0.22593 2.48067,-3.48704 2.93005,-3.4398 0.44938,0.0472 1.81505,3.67147 2.15084,3.97382 0.3358,0.30236 4.08294,1.2817 4.17689,1.72369 0.0939,0.44198 -2.9309,2.86076 -3.11469,3.27355 C 669.9821,591.68426 670.20862,595.55064 669.8173,595.77657 Z" |
294 | + transform="matrix(1.511423,-0.16366377,0.16366377,1.511423,-755.37346,-191.93651)" /> |
295 | + </g> |
296 | + </g> |
297 | + </g> |
298 | + </g> |
299 | +</svg> |
300 | diff --git a/reactive/service_checks.py b/reactive/service_checks.py |
301 | index 50d745e..f22a164 100644 |
302 | --- a/reactive/service_checks.py |
303 | +++ b/reactive/service_checks.py |
304 | @@ -1,4 +1,7 @@ |
305 | +from __future__ import print_function |
306 | +import base64 |
307 | import os |
308 | +import subprocess |
309 | from charms.reactive import ( |
310 | when, |
311 | when_not, |
312 | @@ -21,7 +24,6 @@ from charmhelpers.fetch import ( |
313 | |
314 | from charmhelpers.contrib.charmsupport.nrpe import NRPE |
315 | |
316 | - |
317 | config = hookenv.config() |
318 | install_packages = ['nagios-nrpe-server', 'python-openstackclient'] |
319 | |
320 | @@ -159,6 +161,8 @@ def render_config(): |
321 | render('nagios.novarc', '/var/lib/nagios/nagios.novarc', creds, |
322 | owner='nagios', group='nagios') |
323 | render_checks() |
324 | + if config.get('trusted_ssl_ca', None): |
325 | + fix_ssl() |
326 | set_state('os-service-checks.do-restart') |
327 | |
328 | |
329 | @@ -168,3 +172,13 @@ def do_restart(): |
330 | host.service_restart('nagios-nrpe-server') |
331 | hookenv.status_set('active', 'Ready') |
332 | remove_state('os-service-checks.do-restart') |
333 | + |
334 | + |
335 | +def fix_ssl(): |
336 | + cert_file = '/usr/local/share/ca-certificates/openstack-service-checks.crt' |
337 | + trusted_ssl_ca = config.get('trusted_ssl_ca').strip() |
338 | + hookenv.log("Writing ssl ca cert:{}".format(trusted_ssl_ca)) |
339 | + cert_content = base64.b64decode(trusted_ssl_ca).decode() |
340 | + with open(cert_file, 'w') as f: |
341 | + print(cert_content, file=f) |
342 | + subprocess.call(["/usr/sbin/update-ca-certificates"]) |
lgtm: merged