Merge lp:~cprov/charms/trusty/logstash/ls-custom-config into lp:~tanuki/charms/trusty/logstash/trunk

Proposed by Celso Providelo on 2015-08-13
Status: Merged
Merged at revision: 50
Proposed branch: lp:~cprov/charms/trusty/logstash/ls-custom-config
Merge into: lp:~tanuki/charms/trusty/logstash/trunk
Diff against target: 28 lines (+10/-0)
2 files modified
config.yaml (+4/-0)
hooks/config-changed (+6/-0)
To merge this branch: bzr merge lp:~cprov/charms/trusty/logstash/ls-custom-config
Reviewer Review Type Date Requested Status
Guillermo Gonzalez 2015-08-13 Approve on 2015-08-13
Review via email: mp+267990@code.launchpad.net

Commit message

Support 'extra-config' configuration option. Good for configuring PD output or other bits that depend on private/local information (API key).

Description of the change

Support 'extra-config' configuration option. Good for configuring PD output or other bits that depend on private/local information (API key).

To post a comment you must log in.
Guillermo Gonzalez (verterok) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2015-03-31 09:37:21 +0000
3+++ config.yaml 2015-08-13 19:47:36 +0000
4@@ -19,3 +19,7 @@
5 default: ""
6 type: string
7 description: "Base64-encoded SSL key"
8+ extra-config:
9+ type: string
10+ default: ''
11+ description: "Base64-encoded custom configuration content."
12
13=== modified file 'hooks/config-changed'
14--- hooks/config-changed 2015-08-04 14:10:31 +0000
15+++ hooks/config-changed 2015-08-13 19:47:36 +0000
16@@ -60,6 +60,12 @@
17 p.write(render(os.path.basename(f), opts))
18
19 config_data = hookenv.config()
20+
21+ # Write custom configuration if set.
22+ if config_data['extra_config']:
23+ with open(os.path.join(BASEPATH, 'conf.d', 'extra.conf'), 'w') as f:
24+ f.write(str(base64.b64decode(config_data['extra_config'])))
25+
26 # Only setup lumberjack protocol if ssl cert and key are configured
27 if config_data['ssl_cert'] and config_data['ssl_key']:
28 if not os.path.exists(cert_dir):

Subscribers

People subscribed via source and target branches

to all changes: