Merge ~vlgrevtsev/charm-prometheus-ceph-exporter:lp1807282 into ~prometheus-charmers/charm-prometheus-ceph-exporter/+git/prometheus-ceph-exporter-charm:master

Proposed by Vladimir Grevtsev
Status: Superseded
Proposed branch: ~vlgrevtsev/charm-prometheus-ceph-exporter:lp1807282
Merge into: ~prometheus-charmers/charm-prometheus-ceph-exporter/+git/prometheus-ceph-exporter-charm:master
Diff against target: 46 lines (+9/-6)
1 file modified
reactive/prometheus-ceph-exporter.py (+9/-6)
Reviewer Review Type Date Requested Status
Joel Sing (community) Needs Fixing
Canonical IS Reviewers Pending
Review via email: mp+376783@code.launchpad.net

This proposal has been superseded by a proposal from 2020-07-28.

Commit message

Moving config render under the separate flag and function to ensure the changes in the relation (like monitor IP) will be propagated properly.

LP: #1807282

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Joel Sing (jsing) :
review: Needs Fixing
Revision history for this message
Stuart Bishop (stub) :
Revision history for this message
Vladimir Grevtsev (vlgrevtsev) :
Revision history for this message
Drew Freiberger (afreiberger) wrote :

this is going to need a refactor, as much of this configuration has moved. Not sure if still an issue or not after the Q2/Q3 updates to the charm.

Unmerged commits

3f5db43... by Vladimir Grevtsev

Moving config render under the separate flag and function
to ensure the changes in the relation (like monitor IP) will
be propagated properly.

LP: #1807282

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/reactive/prometheus-ceph-exporter.py b/reactive/prometheus-ceph-exporter.py
2index c0b6db7..63336a3 100644
3--- a/reactive/prometheus-ceph-exporter.py
4+++ b/reactive/prometheus-ceph-exporter.py
5@@ -1,4 +1,4 @@
6-# Copyright 2017 Canonical Ltd
7+# Copyright 2017-2019 Canonical Ltd
8 #
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11@@ -62,12 +62,9 @@ def open_port():
12 hookenv.open_port(PORT_DEF)
13 set_state('ports-open')
14
15-
16 @when('ceph.available')
17-@when_not('exporter.started')
18-def configure_exporter(ceph_client):
19+def write_ceph_conf(ceph_client):
20 service_name = hookenv.service_name()
21- daemon_conf = os.path.join(os.sep, SNAP_DATA, 'daemon_arguments')
22 charm_ceph_conf = os.path.join(os.sep, SNAP_DATA, 'ceph.conf')
23 cephx_key = os.path.join(os.sep, SNAP_DATA, 'ceph.client.%s.keyring' %
24 (service_name))
25@@ -89,7 +86,14 @@ def configure_exporter(ceph_client):
26
27 # Write out the cephx_key also
28 render('ceph.keyring', cephx_key, ceph_key_context)
29+ hookenv.log("Ceph config saved")
30+ set_state('exporter.ready')
31
32+@when('exporter.ready')
33+@when_not('exporter.started')
34+def configure_exporter():
35+ service_name = hookenv.service_name()
36+ daemon_conf = os.path.join(os.sep, SNAP_DATA, 'daemon_arguments')
37 daemon_context = {
38 'daemon_arguments': hookenv.config('daemon_arguments'),
39 'service_name': service_name,
40@@ -108,7 +112,6 @@ def configure_exporter(ceph_client):
41 raise ServiceError("Service didn't start: {}".format(SVC_NAME))
42 set_state('exporter.started')
43
44-
45 def get_exporter_host(interface='ceph-exporter'):
46 """Get address of local ceph-exporter host for use by http clients
47

Subscribers

People subscribed via source and target branches