Merge lp:~michael.nelson/charms/trusty/kibana/kibana4-merge-upstream into lp:~canonical-is-sa/charms/trusty/kibana/kibana4

Proposed by Michael Nelson
Status: Merged
Merged at revision: 23
Proposed branch: lp:~michael.nelson/charms/trusty/kibana/kibana4-merge-upstream
Merge into: lp:~canonical-is-sa/charms/trusty/kibana/kibana4
Diff against target: 97 lines (+21/-17)
5 files modified
hooks/rest-relation-departed (+1/-0)
hooks/rest-relation-joined (+1/-0)
metadata.yaml (+3/-1)
tests/11-scale-elastic.py (+15/-15)
tests/12-port-change.py (+1/-1)
To merge this branch: bzr merge lp:~michael.nelson/charms/trusty/kibana/kibana4-merge-upstream
Reviewer Review Type Date Requested Status
Michael Foley (community) Approve
Review via email: mp+276947@code.launchpad.net

Commit message

Merge upstream kibana changes and update test (so it's not expecting kibana to proxy external requests for :9200 to ES).

Description of the change

This just merges the upstream changes that landed last week (r23) and then updates a test which is assuming that requests to kibana on :9200 will be proxied to ES (something that we've explicitly dis-allowed in our kibana4 branch).

Ensured the test works locally:
dev-trusty# ~/charms/kibana/trusty/kibana
$ ./tests/11-scale-elastic.py
2015-11-09 03:09:35 Starting deployment of local
2015-11-09 03:09:35 Deploying services...
2015-11-09 03:09:35 Deploying service elasticsearch using cs:trusty/elasticsearch-12
2015-11-09 03:09:43 Deploying service kibana using /home/michael/charms/kibana/trusty/kibana
2015-11-09 03:09:48 Deploying service logstash-indexer using cs:precise/logstash-indexer-4
2015-11-09 03:13:08 Adding relations...
2015-11-09 03:13:08 Adding relation logstash-indexer:cluster <-> elasticsearch:client
2015-11-09 03:13:09 Adding relation kibana:rest <-> elasticsearch:client
2015-11-09 03:14:09 Exposing service 'kibana'
2015-11-09 03:14:09 Deployment complete in 275.00 seconds
dev-trusty# ~/charms/kibana/trusty/kibana
$

To post a comment you must log in.
Revision history for this message
Michael Foley (foli) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/rest-relation-departed'
2--- hooks/rest-relation-departed 2013-11-26 08:51:58 +0000
3+++ hooks/rest-relation-departed 2015-11-09 03:19:12 +0000
4@@ -1,2 +1,3 @@
5 #!/bin/sh
6 juju-log $JUJU_REMOTE_UNIT departed
7+close-port 9200/tcp
8
9=== modified file 'hooks/rest-relation-joined'
10--- hooks/rest-relation-joined 2013-11-26 08:51:58 +0000
11+++ hooks/rest-relation-joined 2015-11-09 03:19:12 +0000
12@@ -1,2 +1,3 @@
13 #!/bin/bash
14 juju-log $JUJU_REMOTE_UNIT joined
15+open-port 9200/tcp
16
17=== modified file 'metadata.yaml'
18--- metadata.yaml 2015-10-28 04:08:59 +0000
19+++ metadata.yaml 2015-11-09 03:19:12 +0000
20@@ -1,6 +1,8 @@
21 name: kibana
22 summary: alternative (better) logstash frontend
23-maintainer: Paul Czarkowski <paul@paulcz.net>
24+maintainers:
25+ - Paul Czarkowski <paul@paulcz.net>
26+ - Chris MacNaughton <chris.macnaughton@canonical.com>
27 description: |
28 alternative (better) logstash frontend
29 tags:
30
31=== modified file 'tests/11-scale-elastic.py'
32--- tests/11-scale-elastic.py 2015-10-09 20:54:45 +0000
33+++ tests/11-scale-elastic.py 2015-11-09 03:19:12 +0000
34@@ -33,8 +33,8 @@
35 ##
36 # Set relationship aliases
37 ##
38-kibana_unit = d.sentry.unit['kibana/0']
39-elasticsearch_unit = d.sentry.unit['elasticsearch/1']
40+kibana_unit = d.sentry['kibana'][0]
41+elasticsearch_unit = d.sentry['elasticsearch'][1]
42
43
44 def test_web_interface():
45@@ -50,26 +50,26 @@
46
47 time.sleep(3)
48
49- url = 'http://%s:9200/_all/_search' % kibana_unit.info['public-address']
50- test_dir = os.path.dirname(__file__)
51- test_data_file = os.path.join(test_dir, '11-scale-elastic-query.json')
52- with open(test_data_file) as fp:
53- test_data = json.load(fp)
54- r = requests.get(url, params=test_data)
55- if not r.ok:
56- amulet.raise_status(amulet.FAIL,
57- msg="Error performing search.")
58+ # Ensure the kibana unit can query ES via localhost (it proxies local 9200
59+ # queries to ES)
60+ url = 'http://127.0.0.1:9200/_all/_search'
61+ result = kibana_unit.run(
62+ "curl -XGET {url} -d '@11-scale-elastic-query.json'".format(url=url))
63+ if not result[1] == 0:
64+ amulet.raise_status(
65+ amulet.FAIL, msg="Error performing search. Error code: {}. "
66+ "Result:\n{}".format(result[1], result[0]))
67 try:
68- result = r.json()
69+ result = json.loads(result[0])
70 if result['hits']['total'] != 1:
71 amulet.raise_status(amulet.FAIL,
72 msg="Error inserting value in elasticsearch.")
73 except ValueError:
74 exc_type, value, traceback = sys.exc_info()
75 exc_text = "Exception: (%s) %s. %s" % (value, exc_type, traceback)
76- amulet.raise_status(amulet.FAIL,
77- msg="Value returned not a valid json." + r.text +
78- exc_text)
79+ amulet.raise_status(
80+ amulet.FAIL, msg="Value returned not a valid json.\n{}\n{}".format(
81+ result[0], exc_text))
82
83
84 test_web_interface()
85
86=== modified file 'tests/12-port-change.py'
87--- tests/12-port-change.py 2015-10-09 20:54:45 +0000
88+++ tests/12-port-change.py 2015-11-09 03:19:12 +0000
89@@ -27,7 +27,7 @@
90
91
92 def test_web_interface():
93- kibana_unit = d.sentry.unit['kibana/0']
94+ kibana_unit = d.sentry['kibana'][0]
95 url = 'http://%s:81/' % kibana_unit.info['public-address']
96 r = requests.get(url)
97 if not r.ok:

Subscribers

People subscribed via source and target branches