Merge ~hloeung/influxdb-charm:master into influxdb-charm:master

Proposed by Haw Loeung
Status: Merged
Merged at revision: 731a0f4089f3d103f579c6beee886092776cb806
Proposed branch: ~hloeung/influxdb-charm:master
Merge into: influxdb-charm:master
Diff against target: 31 lines (+8/-0)
1 file modified
reactive/influxdb.py (+8/-0)
Reviewer Review Type Date Requested Status
InfluxDB Charmers Pending
Review via email: mp+333176@code.launchpad.net

Description of the change

Install influxdb-client package if required

Upstream packaged InfluxDB includes the influx CLI shell tool in the
'influxdb' package. Unfortunately, Debian/Ubuntu does not and splits
it out into the 'influxdb-client' package. Let's work around this
here.

I should note that a previous change landed which favors the config shipped out by packages over the charm.

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
1diff --git a/reactive/influxdb.py b/reactive/influxdb.py
2index a8394de..e94869e 100644
3--- a/reactive/influxdb.py
4+++ b/reactive/influxdb.py
5@@ -2,11 +2,13 @@ from charmhelpers.contrib.charmsupport import nrpe
6 from charmhelpers.core import hookenv
7 from charmhelpers.core import host
8 from charmhelpers.core.templating import render
9+from charmhelpers.fetch import apt_install
10 from charms.reactive import hook, set_state, remove_state, when, when_all, when_not
11
12 import re
13 import os
14 import shutil
15+import subprocess
16 import yaml
17
18 CRONFILE = '/etc/cron.daily/influxdb-charm-backup'
19@@ -34,6 +36,12 @@ def install_influx():
20 hookenv.status_set('active', '')
21 set_state('influxdb.configured')
22 set_state('config.changed')
23+ # This is a hack because the CLI shell tool is packaged differently in
24+ # upstream and Debian/Ubuntu. Upstream has no 'influxdb-client' package.
25+ try:
26+ subprocess.check_call(['influx', '--version'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
27+ except OSError:
28+ apt_install('influxdb-client')
29
30
31 def apply_configs(fh, config):

Subscribers

People subscribed via source and target branches

to all changes: