Merge lp:~ivoks/charms/trusty/contrail-analytics/cassandra-authentication into lp:~sdn-charmers/charms/trusty/contrail-analytics/trunk

Proposed by Ante Karamatić
Status: Merged
Merged at revision: 38
Proposed branch: lp:~ivoks/charms/trusty/contrail-analytics/cassandra-authentication
Merge into: lp:~sdn-charmers/charms/trusty/contrail-analytics/trunk
Diff against target: 70 lines (+24/-3)
4 files modified
hooks/contrail_analytics_utils.py (+12/-3)
templates/contrail-analytics-api.conf (+4/-0)
templates/contrail-collector.conf (+4/-0)
templates/contrail-query-engine.conf (+4/-0)
To merge this branch: bzr merge lp:~ivoks/charms/trusty/contrail-analytics/cassandra-authentication
Reviewer Review Type Date Requested Status
Robert Ayres (community) Approve
Review via email: mp+320471@code.launchpad.net

Description of the change

Currently Contrail charms require cassandra to run in unrestricted mode, allowing every user access to all of the data. With this change analytics can use password authentication in Cassandra.

To post a comment you must log in.
Revision history for this message
Robert Ayres (robert-ayres) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/contrail_analytics_utils.py'
2--- hooks/contrail_analytics_utils.py 2017-03-10 13:02:06 +0000
3+++ hooks/contrail_analytics_utils.py 2017-03-21 10:07:54 +0000
4@@ -100,9 +100,18 @@
5 ((unit, relation_get("host", unit, rid),
6 relation_get(key, unit, rid))
7 for unit in related_units(rid))
8- if port ] \
9- if config.get("cassandra-ready") else []
10- return { "cassandra_servers": servers }
11+ if port ]
12+ ctxs = [ { "cassandra_servers": servers,
13+ "cassandra_username": username,
14+ "cassandra_password": password,
15+ }
16+ for rid in relation_ids("cassandra")
17+ for unit, username, password in
18+ ((unit,
19+ relation_get("username", unit, rid),
20+ relation_get("password", unit, rid))
21+ for unit in related_units(rid))]
22+ return ctxs[0] if ctxs else {}
23
24 def cassandra_units():
25 """Return a list of cassandra units"""
26
27=== modified file 'templates/contrail-analytics-api.conf'
28--- templates/contrail-analytics-api.conf 2017-01-31 12:44:08 +0000
29+++ templates/contrail-analytics-api.conf 2017-03-21 10:07:54 +0000
30@@ -17,6 +17,10 @@
31 api_server = {{ api_server ~ ":" ~ api_port if api_server and api_port }}
32 {%- endif %}
33
34+[CASSANDRA]
35+cassandra_user = {{ cassandra_username }}
36+cassandra_password = {{ cassandra_password }}
37+
38 [DISCOVERY]
39 disc_server_ip = {{ disc_server_ip }}
40 disc_server_port = {{ disc_server_port }}
41
42=== modified file 'templates/contrail-collector.conf'
43--- templates/contrail-collector.conf 2017-01-31 12:44:08 +0000
44+++ templates/contrail-collector.conf 2017-03-21 10:07:54 +0000
45@@ -17,6 +17,10 @@
46 syslog_port = 514
47 sflow_port = 6343
48
49+[CASSANDRA]
50+cassandra_user = {{ cassandra_username }}
51+cassandra_password = {{ cassandra_password }}
52+
53 [COLLECTOR]
54 port = 8086
55 server = 0.0.0.0
56
57=== modified file 'templates/contrail-query-engine.conf'
58--- templates/contrail-query-engine.conf 2015-06-11 22:02:41 +0000
59+++ templates/contrail-query-engine.conf 2017-03-21 10:07:54 +0000
60@@ -14,6 +14,10 @@
61 max_slice = 100
62 max_tasks = 16
63
64+[CASSANDRA]
65+cassandra_user = {{ cassandra_username }}
66+cassandra_password = {{ cassandra_password }}
67+
68 [DISCOVERY]
69 port = {{ disc_server_port }}
70 server = {{ disc_server_ip }}

Subscribers

People subscribed via source and target branches