Merge lp:~verterok/charms/trusty/telegraf/fix-influxdb-template into lp:~ubuntuone-hackers/charms/trusty/telegraf/trunk

Proposed by Guillermo Gonzalez
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: 18
Merged at revision: 18
Proposed branch: lp:~verterok/charms/trusty/telegraf/fix-influxdb-template
Merge into: lp:~ubuntuone-hackers/charms/trusty/telegraf/trunk
Diff against target: 22 lines (+8/-5)
1 file modified
hooks/actions.py (+8/-5)
To merge this branch: bzr merge lp:~verterok/charms/trusty/telegraf/fix-influxdb-template
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Approve
Review via email: mp+290738@code.launchpad.net

Commit message

fix influxdb-api hook to include extra options

Description of the change

fix influxdb-api hook to include extra options

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

trivial

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/actions.py'
2--- hooks/actions.py 2016-03-30 17:57:57 +0000
3+++ hooks/actions.py 2016-04-01 14:20:08 +0000
4@@ -304,10 +304,13 @@
5 password = rel['password']
6 config_path = '{}/{}.conf'.format(CONFIG_DIR, 'influxdb-api')
7 if endpoints:
8- hookenv.log("Updating {} plugin config file".format('postgresql'))
9- render(source='influxdb-api.conf.tmpl', target=config_path,
10- context={'urls': json.dumps(endpoints),
11- 'username': '{}'.format(user),
12- 'password': '{}'.format(password)})
13+ hookenv.log("Updating {} plugin config file".format('influxdb-api'))
14+ content = render(source='influxdb-api.conf.tmpl', target=None,
15+ context={'urls': json.dumps(endpoints),
16+ 'username': '{}'.format(user),
17+ 'password': '{}'.format(password)})
18+ extra_opts = render_extra_options("outputs", "influxdb")
19+ host.write_file(config_path, '\n'.join([content, extra_opts]))
20 elif os.path.exists(config_path):
21 os.unlink(config_path)
22+

Subscribers

People subscribed via source and target branches