Merge ~brad-marshall/charm-prometheus-ceph-exporter/+git/prometheus-ceph-exporter-charm:ceph-relation into ~prometheus-charmers/charm-prometheus-ceph-exporter/+git/prometheus-ceph-exporter-charm:master
- Git
- lp:~brad-marshall/charm-prometheus-ceph-exporter/+git/prometheus-ceph-exporter-charm
- ceph-relation
- Merge into master
Proposed by
Brad Marshall
Status: | Merged |
---|---|
Merged at revision: | 2dd00a08819c9bd6dae823816bbd64e50a379217 |
Proposed branch: | ~brad-marshall/charm-prometheus-ceph-exporter/+git/prometheus-ceph-exporter-charm:ceph-relation |
Merge into: | ~prometheus-charmers/charm-prometheus-ceph-exporter/+git/prometheus-ceph-exporter-charm:master |
Diff against target: |
504 lines (+113/-205) 9 files modified
README.md (+1/-0) config.yaml (+9/-27) dev/null (+0/-133) layer.yaml (+10/-15) metadata.yaml (+5/-1) reactive/prometheus-ceph-exporter.py (+47/-29) templates/ceph.conf (+19/-0) templates/ceph.keyring (+5/-0) templates/daemon_arguments (+17/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Barry Price | Approve | ||
Paul Gear (community) | Needs Fixing | ||
Review via email:
|
Commit message
Description of the change
Add in ceph-client relationship so we no longer have to target a ceph-mon node, tidy up the code etc.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/README.md b/README.md | |||
2 | index 2559ee3..59a0103 100644 | |||
3 | --- a/README.md | |||
4 | +++ b/README.md | |||
5 | @@ -22,6 +22,7 @@ From the MAAS host: | |||
6 | 22 | # Deploy the charm | 22 | # Deploy the charm |
7 | 23 | 23 | ||
8 | 24 | juju deploy local:xenial/prometheus-ceph-exporter | 24 | juju deploy local:xenial/prometheus-ceph-exporter |
9 | 25 | juju add-relation prometheus-ceph-exporter ceph-mon:client | ||
10 | 25 | 26 | ||
11 | 26 | To change the port, refer to the daemon_arguments provided by the snap package at: | 27 | To change the port, refer to the daemon_arguments provided by the snap package at: |
12 | 27 | /var/snap/prometheus-ceph-exporter/current/daemon_arguments | 28 | /var/snap/prometheus-ceph-exporter/current/daemon_arguments |
13 | diff --git a/bin/layer_option b/bin/layer_option | |||
14 | 28 | deleted file mode 100755 | 29 | deleted file mode 100755 |
15 | index 90dc400..0000000 | |||
16 | --- a/bin/layer_option | |||
17 | +++ /dev/null | |||
18 | @@ -1,24 +0,0 @@ | |||
19 | 1 | #!/usr/bin/env python3 | ||
20 | 2 | |||
21 | 3 | import sys | ||
22 | 4 | sys.path.append('lib') | ||
23 | 5 | |||
24 | 6 | import argparse | ||
25 | 7 | from charms.layer import options | ||
26 | 8 | |||
27 | 9 | |||
28 | 10 | parser = argparse.ArgumentParser(description='Access layer options.') | ||
29 | 11 | parser.add_argument('section', | ||
30 | 12 | help='the section, or layer, the option is from') | ||
31 | 13 | parser.add_argument('option', | ||
32 | 14 | help='the option to access') | ||
33 | 15 | |||
34 | 16 | args = parser.parse_args() | ||
35 | 17 | value = options(args.section).get(args.option, '') | ||
36 | 18 | if isinstance(value, bool): | ||
37 | 19 | sys.exit(0 if value else 1) | ||
38 | 20 | elif isinstance(value, list): | ||
39 | 21 | for val in value: | ||
40 | 22 | print(val) | ||
41 | 23 | else: | ||
42 | 24 | print(value) | ||
43 | diff --git a/config.yaml b/config.yaml | |||
44 | index 05b882e..4cf7a63 100644 | |||
45 | --- a/config.yaml | |||
46 | +++ b/config.yaml | |||
47 | @@ -1,27 +1,9 @@ | |||
75 | 1 | # Copyright 2016 Canonical Ltd. | 1 | options: |
76 | 2 | # | 2 | username: |
77 | 3 | # This file is part of the Snap layer for Juju. | 3 | description: Username to use for ceph mons - defaults to prometheus-ceph-exporter. |
78 | 4 | # | 4 | type: string |
79 | 5 | # Licensed under the Apache License, Version 2.0 (the "License"); | 5 | default: "prometheus-ceph-exporter" |
80 | 6 | # you may not use this file except in compliance with the License. | 6 | daemon_arguments: |
81 | 7 | # You may obtain a copy of the License at | 7 | description: Daemon arguments to pass to the exporter. |
82 | 8 | # | 8 | type: string |
83 | 9 | # http://www.apache.org/licenses/LICENSE-2.0 | 9 | default: "" |
57 | 10 | # | ||
58 | 11 | # Unless required by applicable law or agreed to in writing, software | ||
59 | 12 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
60 | 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
61 | 14 | # See the License for the specific language governing permissions and | ||
62 | 15 | # limitations under the License. | ||
63 | 16 | "options": | ||
64 | 17 | "snap_proxy": | ||
65 | 18 | "description": "HTTP/HTTPS web proxy for Snappy to use when accessing the snap\ | ||
66 | 19 | \ store.\n" | ||
67 | 20 | "type": "string" | ||
68 | 21 | "default": "" | ||
69 | 22 | "snap_channel": | ||
70 | 23 | "default": "stable" | ||
71 | 24 | "type": "string" | ||
72 | 25 | "description": | | ||
73 | 26 | If install_method is set to "snap" this option controlls channel name. | ||
74 | 27 | Supported values are: "stable", "candidate", "beta" and "edge" | ||
84 | diff --git a/layer.yaml b/layer.yaml | |||
85 | index a3d662a..96ddd93 100644 | |||
86 | --- a/layer.yaml | |||
87 | +++ b/layer.yaml | |||
88 | @@ -1,15 +1,10 @@ | |||
104 | 1 | "options": | 1 | includes: ['layer:basic', 'interface:http', 'layer:snap', 'interface:ceph-client'] |
105 | 2 | "basic": | 2 | repo: 'https://git.launchpad.net/prometheus-ceph-exporter-charm' |
106 | 3 | "use_venv": !!bool "true" | 3 | ignore: ['.*.swp' ] |
107 | 4 | "packages": [] | 4 | options: |
108 | 5 | "include_system_packages": !!bool "false" | 5 | basic: |
109 | 6 | "snap": {} | 6 | use_venv: true |
110 | 7 | "prometheus-ceph-exporter": {} | 7 | include_system_packages: true |
111 | 8 | "includes": | 8 | snap: |
112 | 9 | - "layer:basic" | 9 | prometheus-ceph-exporter: |
113 | 10 | - "interface:http" | 10 | channel: stable |
99 | 11 | - "layer:snap" | ||
100 | 12 | "repo": "https://git.launchpad.net/prometheus-ceph-exporter-charm" | ||
101 | 13 | "ignore": | ||
102 | 14 | "prometheus-ceph-exporter": [".*.swp"] | ||
103 | 15 | "is": "prometheus-ceph-exporter" | ||
114 | diff --git a/metadata.yaml b/metadata.yaml | |||
115 | index e76e3ef..55f3cf5 100644 | |||
116 | --- a/metadata.yaml | |||
117 | +++ b/metadata.yaml | |||
118 | @@ -1,6 +1,6 @@ | |||
119 | 1 | name: prometheus-ceph-exporter | 1 | name: prometheus-ceph-exporter |
120 | 2 | summary: Ceph exporter for Prometheus | 2 | summary: Ceph exporter for Prometheus |
122 | 3 | maintainer: Giorgio Di Guardia <giorgio.diguardia@canonical.com> | 3 | maintainer: Prometheus Charmers <prometheus-charmers@lists.launchpad.net> |
123 | 4 | description: | | 4 | description: | |
124 | 5 | This is an exporter that exposes information gathered from Ceph | 5 | This is an exporter that exposes information gathered from Ceph |
125 | 6 | for use by the Prometheus monitoring system. | 6 | for use by the Prometheus monitoring system. |
126 | @@ -9,7 +9,11 @@ tags: | |||
127 | 9 | - prometheus | 9 | - prometheus |
128 | 10 | series: | 10 | series: |
129 | 11 | - xenial | 11 | - xenial |
130 | 12 | - trusty | ||
131 | 12 | subordinate: false | 13 | subordinate: false |
132 | 13 | provides: | 14 | provides: |
133 | 14 | ceph-exporter: | 15 | ceph-exporter: |
134 | 15 | interface: http | 16 | interface: http |
135 | 17 | requires: | ||
136 | 18 | ceph: | ||
137 | 19 | interface: ceph-client | ||
138 | diff --git a/reactive/__init__.py b/reactive/__init__.py | |||
139 | 16 | deleted file mode 100644 | 20 | deleted file mode 100644 |
140 | index e69de29..0000000 | |||
141 | --- a/reactive/__init__.py | |||
142 | +++ /dev/null | |||
143 | diff --git a/reactive/prometheus-ceph-exporter.py b/reactive/prometheus-ceph-exporter.py | |||
144 | index c6ba0c9..41e9e69 100644 | |||
145 | --- a/reactive/prometheus-ceph-exporter.py | |||
146 | +++ b/reactive/prometheus-ceph-exporter.py | |||
147 | @@ -13,7 +13,7 @@ | |||
148 | 13 | # limitations under the License. | 13 | # limitations under the License. |
149 | 14 | 14 | ||
150 | 15 | import yaml | 15 | import yaml |
152 | 16 | import subprocess | 16 | import os |
153 | 17 | 17 | ||
154 | 18 | from charmhelpers.core import host, hookenv | 18 | from charmhelpers.core import host, hookenv |
155 | 19 | from charmhelpers.core.templating import render | 19 | from charmhelpers.core.templating import render |
156 | @@ -21,37 +21,30 @@ from charms.reactive import ( | |||
157 | 21 | when, when_not, set_state, remove_state | 21 | when, when_not, set_state, remove_state |
158 | 22 | ) | 22 | ) |
159 | 23 | from charms.reactive.helpers import any_file_changed, data_changed | 23 | from charms.reactive.helpers import any_file_changed, data_changed |
161 | 24 | from charms.layer import snap | 24 | # from charms.layer import snap |
162 | 25 | 25 | ||
163 | 26 | from charmhelpers.fetch import ( | ||
164 | 27 | apt_install, | ||
165 | 28 | ) | ||
166 | 26 | 29 | ||
167 | 27 | SNAP_NAME = 'prometheus-ceph-exporter' | 30 | SNAP_NAME = 'prometheus-ceph-exporter' |
168 | 28 | SVC_NAME = 'snap.prometheus-ceph-exporter.ceph-exporter' | 31 | SVC_NAME = 'snap.prometheus-ceph-exporter.ceph-exporter' |
169 | 29 | SNAP_DATA = '/var/snap/' + SNAP_NAME + '/current/' | 32 | SNAP_DATA = '/var/snap/' + SNAP_NAME + '/current/' |
170 | 30 | PORT_DEF = 9128 | 33 | PORT_DEF = 9128 |
171 | 31 | 34 | ||
172 | 35 | |||
173 | 32 | def templates_changed(tmpl_list): | 36 | def templates_changed(tmpl_list): |
174 | 33 | return any_file_changed(['templates/{}'.format(x) for x in tmpl_list]) | 37 | return any_file_changed(['templates/{}'.format(x) for x in tmpl_list]) |
175 | 34 | 38 | ||
176 | 35 | 39 | ||
177 | 36 | @when_not('ceph-exporter.installed') | ||
178 | 37 | def install_packages(): | ||
179 | 38 | hookenv.status_set('maintenance', 'Installing software') | ||
180 | 39 | config = hookenv.config() | ||
181 | 40 | channel = config.get('snap_channel', 'stable') | ||
182 | 41 | snap.install(SNAP_NAME, channel=channel, force_dangerous=False) | ||
183 | 42 | set_state('ceph-exporter.do-auth-config') | ||
184 | 43 | set_state('ceph-exporter.installed') | ||
185 | 44 | set_state('ceph-exporter.do-check-reconfig') | ||
186 | 45 | |||
187 | 46 | |||
188 | 47 | def validate_config(filename): | 40 | def validate_config(filename): |
189 | 48 | return yaml.safe_load(open(filename)) | 41 | return yaml.safe_load(open(filename)) |
190 | 49 | 42 | ||
191 | 50 | 43 | ||
193 | 51 | @when('ceph-exporter.installed') | 44 | @when('snap.installed.prometheus-ceph-exporter') |
194 | 52 | @when('ceph-exporter.do-reconfig-yaml') | 45 | @when('ceph-exporter.do-reconfig-yaml') |
195 | 53 | def write_ceph_exporter_config_yaml(): | 46 | def write_ceph_exporter_config_yaml(): |
197 | 54 | config = hookenv.config() | 47 | # config = hookenv.config() |
198 | 55 | hookenv.open_port(PORT_DEF) | 48 | hookenv.open_port(PORT_DEF) |
199 | 56 | set_state('ceph-exporter.do-restart') | 49 | set_state('ceph-exporter.do-restart') |
200 | 57 | remove_state('ceph-exporter.do-reconfig-yaml') | 50 | remove_state('ceph-exporter.do-reconfig-yaml') |
201 | @@ -71,19 +64,44 @@ def check_reconfig_ceph_exporter(): | |||
202 | 71 | remove_state('ceph-exporter.do-check-reconfig') | 64 | remove_state('ceph-exporter.do-check-reconfig') |
203 | 72 | 65 | ||
204 | 73 | 66 | ||
218 | 74 | @when('ceph-exporter.do-auth-config') | 67 | @when('ceph.connected') |
219 | 75 | def ceph_auth_config(): | 68 | def ceph_connected(ceph_client): |
220 | 76 | # Working around snap confinement, creating ceph user, moving conf to snap confined environment ($SNAP_DATA) | 69 | apt_install(['ceph-common', 'python-ceph']) |
221 | 77 | hookenv.status_set('maintenance', 'Creating ceph user') | 70 | |
222 | 78 | hookenv.log('Creating exporter ceph user') | 71 | |
223 | 79 | subprocess.check_call(['ceph', 'auth', 'add', 'client.exporter', 'mon', "allow r"]) | 72 | @when('ceph.available') |
224 | 80 | hookenv.log('Creating exporter keyring file onto {}'.format(SNAP_DATA)) | 73 | def ceph_ready(ceph_client): |
225 | 81 | subprocess.check_call(['ceph', 'auth', 'get', 'client.exporter', '-o', SNAP_DATA + 'ceph.client.exporter.keyring']) | 74 | username = hookenv.config('username') |
226 | 82 | hookenv.log('Copying ceph.conf onto {}'.format(SNAP_DATA)) | 75 | daemon_conf = os.path.join(os.sep, SNAP_DATA, 'daemon_arguments') |
227 | 83 | subprocess.check_call(['cp', '/etc/ceph/ceph.conf', SNAP_DATA + 'ceph.conf']) | 76 | charm_ceph_conf = os.path.join(os.sep, SNAP_DATA, 'ceph.conf') |
228 | 84 | hookenv.log('Modifying snap ceph.conf to point to $SNAP_DATA') | 77 | cephx_key = os.path.join(os.sep, SNAP_DATA, 'ceph.client.%s.keyring' % (username)) |
229 | 85 | subprocess.check_call(['sed', '-i', 's=/etc/ceph/=' + SNAP_DATA + '=g', SNAP_DATA + 'ceph.conf']) | 78 | |
230 | 86 | remove_state('ceph-exporter.do-auth-config') | 79 | ceph_context = { |
231 | 80 | 'auth_supported': ceph_client.auth(), | ||
232 | 81 | 'mon_hosts': ceph_client.mon_hosts(), | ||
233 | 82 | 'service_name': username, | ||
234 | 83 | 'ringpath': SNAP_DATA, | ||
235 | 84 | } | ||
236 | 85 | |||
237 | 86 | # Write out the ceph.conf | ||
238 | 87 | render('ceph.conf', charm_ceph_conf, ceph_context) | ||
239 | 88 | |||
240 | 89 | ceph_key_context = { | ||
241 | 90 | 'key': str(ceph_client.key()), | ||
242 | 91 | 'username': username, | ||
243 | 92 | } | ||
244 | 93 | |||
245 | 94 | # Write out the cephx_key also | ||
246 | 95 | render('ceph.keyring', cephx_key, ceph_key_context) | ||
247 | 96 | |||
248 | 97 | daemon_context = { | ||
249 | 98 | 'daemon_arguments': hookenv.config('daemon_arguments'), | ||
250 | 99 | 'username': username, | ||
251 | 100 | } | ||
252 | 101 | |||
253 | 102 | # Write out the daemon.arguments file | ||
254 | 103 | render('daemon_arguments', daemon_conf, daemon_context) | ||
255 | 104 | |||
256 | 87 | 105 | ||
257 | 88 | @when('ceph-exporter.do-restart') | 106 | @when('ceph-exporter.do-restart') |
258 | 89 | def restart_ceph_exporter(): | 107 | def restart_ceph_exporter(): |
259 | @@ -100,6 +118,6 @@ def restart_ceph_exporter(): | |||
260 | 100 | 118 | ||
261 | 101 | # Relations | 119 | # Relations |
262 | 102 | @when('ceph-exporter.started') | 120 | @when('ceph-exporter.started') |
264 | 103 | @when('ceph-exporter.available') # Relation name is "ceph-exporter" | 121 | @when('ceph-exporter.available') # Relation name is "ceph-exporter" |
265 | 104 | def configure_ceph_exporter_relation(target): | 122 | def configure_ceph_exporter_relation(target): |
266 | 105 | target.configure(PORT_DEF) | 123 | target.configure(PORT_DEF) |
267 | diff --git a/reactive/snap.py b/reactive/snap.py | |||
268 | 106 | deleted file mode 100644 | 124 | deleted file mode 100644 |
269 | index d357e05..0000000 | |||
270 | --- a/reactive/snap.py | |||
271 | +++ /dev/null | |||
272 | @@ -1,133 +0,0 @@ | |||
273 | 1 | # Copyright 2016 Canonical Ltd. | ||
274 | 2 | # | ||
275 | 3 | # This file is part of the Snap layer for Juju. | ||
276 | 4 | # | ||
277 | 5 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
278 | 6 | # you may not use this file except in compliance with the License. | ||
279 | 7 | # You may obtain a copy of the License at | ||
280 | 8 | # | ||
281 | 9 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
282 | 10 | # | ||
283 | 11 | # Unless required by applicable law or agreed to in writing, software | ||
284 | 12 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
285 | 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
286 | 14 | # See the License for the specific language governing permissions and | ||
287 | 15 | # limitations under the License. | ||
288 | 16 | ''' | ||
289 | 17 | charms.reactive helpers for dealing with Snap packages. | ||
290 | 18 | ''' | ||
291 | 19 | import os.path | ||
292 | 20 | import shutil | ||
293 | 21 | import subprocess | ||
294 | 22 | from textwrap import dedent | ||
295 | 23 | import time | ||
296 | 24 | |||
297 | 25 | from charmhelpers.core import hookenv, host | ||
298 | 26 | from charms import layer | ||
299 | 27 | from charms import reactive | ||
300 | 28 | from charms.layer import snap | ||
301 | 29 | from charms.reactive import hook | ||
302 | 30 | from charms.reactive.helpers import data_changed | ||
303 | 31 | |||
304 | 32 | |||
305 | 33 | def install(): | ||
306 | 34 | opts = layer.options('snap') | ||
307 | 35 | for snapname, snap_opts in opts.items(): | ||
308 | 36 | snap.install(snapname, **snap_opts) | ||
309 | 37 | if data_changed('snap.install.opts', opts): | ||
310 | 38 | snap.connect_all() | ||
311 | 39 | |||
312 | 40 | |||
313 | 41 | def refresh(): | ||
314 | 42 | opts = layer.options('snap') | ||
315 | 43 | for snapname, snap_opts in opts.items(): | ||
316 | 44 | snap.refresh(snapname, **snap_opts) | ||
317 | 45 | snap.connect_all() | ||
318 | 46 | |||
319 | 47 | |||
320 | 48 | @hook('upgrade-charm') | ||
321 | 49 | def upgrade_charm(): | ||
322 | 50 | refresh() | ||
323 | 51 | |||
324 | 52 | |||
325 | 53 | def get_series(): | ||
326 | 54 | return subprocess.check_output(['lsb_release', '-sc'], | ||
327 | 55 | universal_newlines=True).strip() | ||
328 | 56 | |||
329 | 57 | |||
330 | 58 | def ensure_snapd(): | ||
331 | 59 | # I don't use the apt layer, because that would tie this layer | ||
332 | 60 | # too closely to apt packaging. Perhaps this is a snap-only system. | ||
333 | 61 | if not shutil.which('snap'): | ||
334 | 62 | cmd = ['apt', 'install', '-y', 'snapd'] | ||
335 | 63 | subprocess.check_call(cmd, universal_newlines=True) | ||
336 | 64 | # Work around lp:1628289. Remove this stanza once snapd depends | ||
337 | 65 | # on the necessary package and snaps work in lxd xenial containers | ||
338 | 66 | # without the workaround. | ||
339 | 67 | if get_series() == 'xenial' and not shutil.which('squashfuse'): | ||
340 | 68 | cmd = ['apt', 'install', '-y', 'squashfuse'] | ||
341 | 69 | subprocess.check_call(cmd, universal_newlines=True) | ||
342 | 70 | |||
343 | 71 | |||
344 | 72 | def update_snap_proxy(): | ||
345 | 73 | # This is a hack based on | ||
346 | 74 | # https://bugs.launchpad.net/layer-snap/+bug/1533899/comments/1 | ||
347 | 75 | # Do it properly when Bug #1533899 is addressed. | ||
348 | 76 | # Note we can't do this in a standard reactive handler as we need | ||
349 | 77 | # to ensure proxies are configured before attempting installs or | ||
350 | 78 | # updates. | ||
351 | 79 | proxy = hookenv.config()['snap_proxy'] | ||
352 | 80 | if not data_changed('snap.proxy', proxy): | ||
353 | 81 | return # Short circuit avoids unnecessary restarts. | ||
354 | 82 | |||
355 | 83 | path = '/etc/systemd/system/snapd.service.d/snap_layer_proxy.conf' | ||
356 | 84 | if proxy: | ||
357 | 85 | create_snap_proxy_conf(path, proxy) | ||
358 | 86 | else: | ||
359 | 87 | remove_snap_proxy_conf(path) | ||
360 | 88 | subprocess.check_call(['systemctl', 'daemon-reload'], | ||
361 | 89 | universal_newlines=True) | ||
362 | 90 | time.sleep(2) | ||
363 | 91 | subprocess.check_call(['systemctl', 'restart', 'snapd.service'], | ||
364 | 92 | universal_newlines=True) | ||
365 | 93 | |||
366 | 94 | |||
367 | 95 | def create_snap_proxy_conf(path, proxy): | ||
368 | 96 | host.mkdir(os.path.dirname(path)) | ||
369 | 97 | content = dedent('''\ | ||
370 | 98 | # Managed by Juju | ||
371 | 99 | [Service] | ||
372 | 100 | Environment=http_proxy={} | ||
373 | 101 | Environment=https_proxy={} | ||
374 | 102 | ''').format(proxy, proxy) | ||
375 | 103 | host.write_file(path, content.encode()) | ||
376 | 104 | |||
377 | 105 | |||
378 | 106 | def remove_snap_proxy_conf(path): | ||
379 | 107 | if os.path.exists(path): | ||
380 | 108 | os.remove(path) | ||
381 | 109 | |||
382 | 110 | |||
383 | 111 | def ensure_path(): | ||
384 | 112 | # Per Bug #1662856, /snap/bin may be missing from $PATH. Fix this. | ||
385 | 113 | if '/snap/bin' not in os.environ['PATH'].split(':'): | ||
386 | 114 | os.environ['PATH'] += ':/snap/bin' | ||
387 | 115 | |||
388 | 116 | |||
389 | 117 | # Per https://github.com/juju-solutions/charms.reactive/issues/33, | ||
390 | 118 | # this module may be imported multiple times so ensure the | ||
391 | 119 | # initialization hook is only registered once. I have to piggy back | ||
392 | 120 | # onto the namespace of a module imported before reactive discovery | ||
393 | 121 | # to do this. | ||
394 | 122 | if not hasattr(reactive, '_snap_registered'): | ||
395 | 123 | # We need to register this to run every hook, not just during install | ||
396 | 124 | # and config-changed, to protect against race conditions. If we don't | ||
397 | 125 | # do this, then the config in the hook environment may show updates | ||
398 | 126 | # to running hooks well before the config-changed hook has been invoked | ||
399 | 127 | # and the intialization provided an opertunity to be run. | ||
400 | 128 | hookenv.atstart(hookenv.log, 'Initializing Snap Layer') | ||
401 | 129 | hookenv.atstart(ensure_snapd) | ||
402 | 130 | hookenv.atstart(ensure_path) | ||
403 | 131 | hookenv.atstart(update_snap_proxy) | ||
404 | 132 | hookenv.atstart(install) | ||
405 | 133 | reactive._snap_registered = True | ||
406 | diff --git a/templates/ceph.conf b/templates/ceph.conf | |||
407 | 134 | new file mode 100644 | 0 | new file mode 100644 |
408 | index 0000000..91459c6 | |||
409 | --- /dev/null | |||
410 | +++ b/templates/ceph.conf | |||
411 | @@ -0,0 +1,19 @@ | |||
412 | 1 | ############################################################################### | ||
413 | 2 | # [ WARNING ] | ||
414 | 3 | # glance configuration file maintained by Juju | ||
415 | 4 | # local changes may be overwritten. | ||
416 | 5 | ############################################################################### | ||
417 | 6 | [global] | ||
418 | 7 | {% if auth_supported -%} | ||
419 | 8 | auth_supported = {{ auth_supported }} | ||
420 | 9 | #keyring = /etc/ceph/$cluster.$name.keyring | ||
421 | 10 | keyring = {{ ringpath }}ceph.client.{{ service_name }}.keyring | ||
422 | 11 | mon host = {{ mon_hosts | join(' ') }} | ||
423 | 12 | |||
424 | 13 | {% endif -%} | ||
425 | 14 | {% if use_syslog -%} | ||
426 | 15 | log to syslog = {{ use_syslog }} | ||
427 | 16 | err to syslog = {{ use_syslog }} | ||
428 | 17 | clog to syslog = {{ use_syslog }} | ||
429 | 18 | {% endif -%} | ||
430 | 19 | |||
431 | diff --git a/templates/ceph.keyring b/templates/ceph.keyring | |||
432 | 0 | new file mode 100644 | 20 | new file mode 100644 |
433 | index 0000000..3781aa1 | |||
434 | --- /dev/null | |||
435 | +++ b/templates/ceph.keyring | |||
436 | @@ -0,0 +1,5 @@ | |||
437 | 1 | [client.{{ username }}] | ||
438 | 2 | key = {{ key }} | ||
439 | 3 | caps mon = "allow r" | ||
440 | 4 | caps osd = "allow rwx" | ||
441 | 5 | |||
442 | diff --git a/templates/daemon_arguments b/templates/daemon_arguments | |||
443 | 0 | new file mode 100644 | 6 | new file mode 100644 |
444 | index 0000000..bb40eef | |||
445 | --- /dev/null | |||
446 | +++ b/templates/daemon_arguments | |||
447 | @@ -0,0 +1,17 @@ | |||
448 | 1 | # Set the command-line arguments to pass to the ceph_exporter daemon | ||
449 | 2 | {% if username is defined %} | ||
450 | 3 | ARGS="-ceph.user {{ username }} {{ daemon_arguments }}" | ||
451 | 4 | {%- else -%} | ||
452 | 5 | ARGS="{{ daemon_arguments }}" | ||
453 | 6 | {% endif %} | ||
454 | 7 | |||
455 | 8 | # Example of the commands: | ||
456 | 9 | # -ceph.config string | ||
457 | 10 | # path to ceph config file | ||
458 | 11 | # -ceph.user string | ||
459 | 12 | # Ceph user to connect to cluster. (default "admin") | ||
460 | 13 | # -telemetry.addr string | ||
461 | 14 | # host:port for ceph exporter (default ":9128") | ||
462 | 15 | # -telemetry.path string | ||
463 | 16 | # URL path for surfacing collected metrics (default "/metrics") | ||
464 | 17 | |||
465 | diff --git a/wheelhouse/Jinja2-2.9.5.tar.gz b/wheelhouse/Jinja2-2.9.5.tar.gz | |||
466 | 0 | deleted file mode 100644 | 18 | deleted file mode 100644 |
467 | index 82ae159..0000000 | |||
468 | 1 | Binary files a/wheelhouse/Jinja2-2.9.5.tar.gz and /dev/null differ | 19 | Binary files a/wheelhouse/Jinja2-2.9.5.tar.gz and /dev/null differ |
469 | diff --git a/wheelhouse/MarkupSafe-0.23.tar.gz b/wheelhouse/MarkupSafe-0.23.tar.gz | |||
470 | 2 | deleted file mode 100644 | 20 | deleted file mode 100644 |
471 | index 6b19006..0000000 | |||
472 | 3 | Binary files a/wheelhouse/MarkupSafe-0.23.tar.gz and /dev/null differ | 21 | Binary files a/wheelhouse/MarkupSafe-0.23.tar.gz and /dev/null differ |
473 | diff --git a/wheelhouse/PyYAML-3.12.tar.gz b/wheelhouse/PyYAML-3.12.tar.gz | |||
474 | 4 | deleted file mode 100644 | 22 | deleted file mode 100644 |
475 | index aabee39..0000000 | |||
476 | 5 | Binary files a/wheelhouse/PyYAML-3.12.tar.gz and /dev/null differ | 23 | Binary files a/wheelhouse/PyYAML-3.12.tar.gz and /dev/null differ |
477 | diff --git a/wheelhouse/Tempita-0.5.2.tar.gz b/wheelhouse/Tempita-0.5.2.tar.gz | |||
478 | 6 | deleted file mode 100644 | 24 | deleted file mode 100644 |
479 | index 755befc..0000000 | |||
480 | 7 | Binary files a/wheelhouse/Tempita-0.5.2.tar.gz and /dev/null differ | 25 | Binary files a/wheelhouse/Tempita-0.5.2.tar.gz and /dev/null differ |
481 | diff --git a/wheelhouse/charmhelpers-0.13.0.tar.gz b/wheelhouse/charmhelpers-0.13.0.tar.gz | |||
482 | 8 | deleted file mode 100644 | 26 | deleted file mode 100644 |
483 | index c862e55..0000000 | |||
484 | 9 | Binary files a/wheelhouse/charmhelpers-0.13.0.tar.gz and /dev/null differ | 27 | Binary files a/wheelhouse/charmhelpers-0.13.0.tar.gz and /dev/null differ |
485 | diff --git a/wheelhouse/charms.reactive-0.4.5.tar.gz b/wheelhouse/charms.reactive-0.4.5.tar.gz | |||
486 | 10 | deleted file mode 100644 | 28 | deleted file mode 100644 |
487 | index ff4e308..0000000 | |||
488 | 11 | Binary files a/wheelhouse/charms.reactive-0.4.5.tar.gz and /dev/null differ | 29 | Binary files a/wheelhouse/charms.reactive-0.4.5.tar.gz and /dev/null differ |
489 | diff --git a/wheelhouse/netaddr-0.7.19.tar.gz b/wheelhouse/netaddr-0.7.19.tar.gz | |||
490 | 12 | deleted file mode 100644 | 30 | deleted file mode 100644 |
491 | index cc31d9d..0000000 | |||
492 | 13 | Binary files a/wheelhouse/netaddr-0.7.19.tar.gz and /dev/null differ | 31 | Binary files a/wheelhouse/netaddr-0.7.19.tar.gz and /dev/null differ |
493 | diff --git a/wheelhouse/pip-8.1.2.tar.gz b/wheelhouse/pip-8.1.2.tar.gz | |||
494 | 14 | deleted file mode 100644 | 32 | deleted file mode 100644 |
495 | index e7a1a3c..0000000 | |||
496 | 15 | Binary files a/wheelhouse/pip-8.1.2.tar.gz and /dev/null differ | 33 | Binary files a/wheelhouse/pip-8.1.2.tar.gz and /dev/null differ |
497 | diff --git a/wheelhouse/pyaml-16.12.2.tar.gz b/wheelhouse/pyaml-16.12.2.tar.gz | |||
498 | 16 | deleted file mode 100644 | 34 | deleted file mode 100644 |
499 | index 2ff0b0a..0000000 | |||
500 | 17 | Binary files a/wheelhouse/pyaml-16.12.2.tar.gz and /dev/null differ | 35 | Binary files a/wheelhouse/pyaml-16.12.2.tar.gz and /dev/null differ |
501 | diff --git a/wheelhouse/six-1.10.0.tar.gz b/wheelhouse/six-1.10.0.tar.gz | |||
502 | 18 | deleted file mode 100644 | 36 | deleted file mode 100644 |
503 | index ac8eec5..0000000 | |||
504 | 19 | Binary files a/wheelhouse/six-1.10.0.tar.gz and /dev/null differ | 37 | Binary files a/wheelhouse/six-1.10.0.tar.gz and /dev/null differ |
This chrm needs disentangling from the snap layer and turning into its own layer before we move forward with it.