Merge ~paulgear/influxdb-charm/+git/influxdb-charm:master into influxdb-charm:master

Proposed by Paul Gear
Status: Merged
Merged at revision: 2d8533e9b9e72a39eee877dea01440415bd7cab2
Proposed branch: ~paulgear/influxdb-charm/+git/influxdb-charm:master
Merge into: influxdb-charm:master
Diff against target: 101 lines (+34/-31)
2 files modified
layer.yaml (+1/-1)
reactive/influxdb.py (+33/-30)
Reviewer Review Type Date Requested Status
Haw Loeung Approve
Review via email: mp+332167@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/layer.yaml b/layer.yaml
2index fec7bfa..37d19f1 100644
3--- a/layer.yaml
4+++ b/layer.yaml
5@@ -1,4 +1,4 @@
6-repo: https://github.com/ChrisMacNaughton/charm-influx
7+repo: https://git.launchpad.net/influxdb-charm
8 includes:
9 - layer:basic
10 - layer:apt
11diff --git a/reactive/influxdb.py b/reactive/influxdb.py
12index 126258b..56e7a22 100644
13--- a/reactive/influxdb.py
14+++ b/reactive/influxdb.py
15@@ -2,9 +2,8 @@ from charmhelpers.core import hookenv
16 from charmhelpers.core.host import service_start, service_stop
17 from charmhelpers.core.templating import render
18 from charms.reactive import when, when_not
19-from charms.reactive import set_state, remove_state
20+from charms.reactive import set_state
21
22-from subprocess import check_call, CalledProcessError
23
24 @when('admin.available')
25 def configure_website(website):
26@@ -12,43 +11,47 @@ def configure_website(website):
27 port = config.get('bind_port')
28 website.configure(port=port)
29
30+
31 @when_not('influxdb.configured')
32 @when('apt.installed.influxdb')
33 def install_influx():
34- config = hookenv.config()
35- port = config.get('bind_port')
36- hookenv.open_port(8083)
37- hookenv.open_port(port)
38- config_changed()
39- service_start('influxdb')
40- hookenv.status_set('active', '')
41- set_state('influxdb.configured')
42+ config = hookenv.config()
43+ port = config.get('bind_port')
44+ hookenv.open_port(8083)
45+ hookenv.open_port(port)
46+ config_changed()
47+ service_start('influxdb')
48+ hookenv.status_set('active', '')
49+ set_state('influxdb.configured')
50+
51
52 @when('config.changed')
53 def config_changed():
54- config = hookenv.config()
55- port = config.get('bind_port')
56- ip_address = config.get('ip_address')
57- render(source='influxdb.conf',
58- target='/etc/influxdb/influxdb.conf',
59- owner='root',
60- perms=0o644,
61- context={
62- 'admin': 'true',
63- 'bind_port': port,
64- 'ip_address': ip_address,
65- })
66- service_stop('influxdb')
67- service_start('influxdb')
68+ config = hookenv.config()
69+ port = config.get('bind_port')
70+ ip_address = config.get('ip_address')
71+ render(source='influxdb.conf',
72+ target='/etc/influxdb/influxdb.conf',
73+ owner='root',
74+ perms=0o644,
75+ context={
76+ 'admin': 'true',
77+ 'bind_port': port,
78+ 'ip_address': ip_address,
79+ })
80+ service_stop('influxdb')
81+ service_start('influxdb')
82+
83
84 @when('query.api.available')
85 def query_available(query):
86- config = hookenv.config()
87- port = config.get('bind_port')
88- query.configure(port=port)
89+ config = hookenv.config()
90+ port = config.get('bind_port')
91+ query.configure(port=port)
92+
93
94 @when('grafana-source.available')
95 def configure_grafana(grafana):
96- config = hookenv.config()
97- port = config.get('bind_port')
98- grafana.provide('influxdb', port, 'Juju generated source')
99+ config = hookenv.config()
100+ port = config.get('bind_port')
101+ grafana.provide('influxdb', port, 'Juju generated source')

Subscribers

People subscribed via source and target branches

to all changes: