Merge lp:~evarlast/charms/trusty/elasticsearch/add-version-config into lp:~charmers/charms/trusty/elasticsearch/trunk

Proposed by Jay R. Wren
Status: Rejected
Rejected by: Marco Ceppi
Proposed branch: lp:~evarlast/charms/trusty/elasticsearch/add-version-config
Merge into: lp:~charmers/charms/trusty/elasticsearch/trunk
Diff against target: 96 lines (+41/-7)
4 files modified
config.yaml (+13/-0)
tasks/install-elasticsearch.yml (+13/-6)
tests/01-config-changes (+8/-1)
tests/helpers/__init__.py (+7/-0)
To merge this branch: bzr merge lp:~evarlast/charms/trusty/elasticsearch/add-version-config
Reviewer Review Type Date Requested Status
Kevin W Monroe Disapprove
Whit Morriss (community) Needs Fixing
Review Queue (community) automated testing Needs Fixing
Michael Nelson (community) Approve
charmers Pending
Review via email: mp+237916@code.launchpad.net

Description of the change

Allow specifying the version of the elasticsearch package in charm config.

Use case: as an op, I must control what version of services I roll out to my production and other environments, so that I can test new versions while retaining the ability to roll out new old versions in both existing and new environments.

To post a comment you must log in.
Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-1269-results

review: Needs Fixing (automated testing)
Revision history for this message
Michael Nelson (michael.nelson) wrote :

Hi Jay,

Thanks for the update. Just fyi, the reason this hasn't been an issue in our usage is that as an op, we configure our own repository (ie. we control the private repo we're using to install from).

I understand that's not useful for everyone, so another option is to instead provide the deb in the charm (files/elasticsearch.deb) and this will be used instead (ie. under your total control).

That said, +1 to your change.

I need to update the tests so that test deps are installed (nosetests), and the amulet tests run on trusty, not precise (I'll find out about that).

Thanks!

review: Approve
Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-10370-results

review: Needs Fixing (automated testing)
Revision history for this message
Michael Nelson (michael.nelson) wrote :
Revision history for this message
Jay R. Wren (evarlast) wrote :

Ah! Thanks for this.

I missed that the official charm is from ~onlineservices-charmers.

On Sun, Nov 23, 2014 at 2:55 PM, Michael Nelson <
<email address hidden>> wrote:

> You probably want to remerge trunk from
>
>
> https://code.launchpad.net/~onlineservices-charmers/charms/trusty/elasticsearch/trunk
> --
>
> https://code.launchpad.net/~evarlast/charms/trusty/elasticsearch/add-version-config/+merge/237916
> You are the owner of
> lp:~evarlast/charms/trusty/elasticsearch/add-version-config.
>

Revision history for this message
Whit Morriss (whitmo) wrote :

Taking a look at this branch. lp:~evarlast/charms/trusty/elasticsearch/add-version-config does not merge cleanly into head of https://code.launchpad.net/~onlineservices-charmers/charms/trusty/elasticsearch/trunk or vice versa.

I'm also curious what the relationship of the charmer/charms version and the online services version (which is more active) is / should be. The online services copy is clearly the canonical one, but whose responsibility is it to keep the charmers copy synced?

Revision history for this message
Whit Morriss (whitmo) wrote :

Marking a need fixing until the merge/upstream resolution gets figured out. Thanks y'all!

review: Needs Fixing
Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

Just spoke to Jay. This change was needed last year to be able to handle a specific elasticsearch minor rev. It hasn't been needed since.

If this version-config feature becomes needed in the future, Jay will refactor his changes to apply to the latest ~onlineservices-charmers charm and open a new MP. Recommend rejecting/closing this MP.

As a side note, if this feature does become active again, please watch out for immutable config. If the version config is changed post-deployment, the charm will need to handle that. Adding config-changed to the yml may be all you need to do this:

...
+ tags:
+ - config-changed
+ - install
+ - upgrade-charm
...

review: Disapprove

Unmerged revisions

36. By Jay R. Wren

Add version config option

Disabled install-recommends.
Disabled extra unneeded runs of apt-get update.

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 2014-07-07 10:22:27 +0000
3+++ config.yaml 2014-10-10 08:45:07 +0000
4@@ -15,3 +15,16 @@
5 default: "elasticsearch"
6 description: |
7 This sets the elasticsearch cluster name.
8+ version:
9+ type: string
10+ default: ""
11+ description: |
12+ This sets the version of the package to be installed from the
13+ repository. A default value of empty string will use the latest
14+ version. This version must match a version in the repository specified
15+ in teh apt-repository option. e.g. set this to 1.3.4 and set
16+ apt-repository to "deb
17+ http://packages.elasticsearch.org/elasticsearch/1.3/debian stable main"
18+ to prevent future deploys of bundles using this charm from
19+ automatically using 1.3.5 or newer when they are added to the
20+ repository.
21
22=== modified file 'tasks/install-elasticsearch.yml'
23--- tasks/install-elasticsearch.yml 2014-07-07 15:37:42 +0000
24+++ tasks/install-elasticsearch.yml 2014-10-10 08:45:07 +0000
25@@ -17,7 +17,7 @@
26 when: apt_repository != ""
27
28 - name: Install dependent packages.
29- apt: pkg={{ item }} state=latest update_cache=yes
30+ apt: pkg={{ item }} state=latest update_cache=yes install_recommends=no
31 tags:
32 - install
33 - upgrade-charm
34@@ -33,11 +33,18 @@
35 - upgrade-charm
36
37 - name: Install elasticsearch from repository
38- apt: pkg=elasticsearch state=latest update_cache=yes
39- tags:
40- - install
41- - upgrade-charm
42- when: stat_elasticsearch_deb.stat.exists == false and apt_repository != ""
43+ apt: pkg=elasticsearch={{ version }} update_cache=no install_recommends=no
44+ tags:
45+ - install
46+ - upgrade-charm
47+ when: stat_elasticsearch_deb.stat.exists == false and apt_repository != "" and version != ""
48+
49+- name: Install elasticsearch from repository
50+ apt: pkg=elasticsearch state=latest update_cache=no install_recommends=no
51+ tags:
52+ - install
53+ - upgrade-charm
54+ when: stat_elasticsearch_deb.stat.exists == false and apt_repository != "" and version == ""
55
56 - name: Install ElasticSearch from payload
57 command: dpkg -i {{ charm_dir }}/files/elasticsearch.deb
58
59=== modified file 'tests/01-config-changes'
60--- tests/01-config-changes 2014-02-10 13:16:56 +0000
61+++ tests/01-config-changes 2014-10-10 08:45:07 +0000
62@@ -7,7 +7,7 @@
63 d = amulet.Deployment()
64
65 d.add('elasticsearch')
66-config = {'cluster-name': 'unique-name'}
67+config = {'cluster-name': 'unique-name', 'version': '1.2.2'}
68 d.configure('elasticsearch', config)
69
70 helpers.setup_deployment(d)
71@@ -20,3 +20,10 @@
72 msg = ("Expected cluster name to be 'unique-name' "
73 "but was '{}'.".format(cluster_name))
74 amulet.raise_status(amulet.FAIL, msg=msg)
75+
76+version = helpers.get_root_status(d)['version']['number']
77+print d.services['elasticsearch']['options']
78+if version != config[version]:
79+ msg = ("Expected version to be '{}' "
80+ "but was '{}'.".format(cluster_name, config['version']))
81+ amulet.raise_status(amulet.FAIL, msg=msg)
82
83=== modified file 'tests/helpers/__init__.py'
84--- tests/helpers/__init__.py 2014-02-10 13:16:56 +0000
85+++ tests/helpers/__init__.py 2014-10-10 08:45:07 +0000
86@@ -49,3 +49,10 @@
87 response = requests.get(addr + "/_cluster/health/" + index_name)
88 check_response(response, expected_code=200)
89 return response.json()
90+
91+
92+def get_root_status(deployment, unit_number=0):
93+ addr = get_unit_address(deployment, unit_number=0)
94+ response = requests.get(addr)
95+ check_response(response, expected_code=200)
96+ return response.json()

Subscribers

People subscribed via source and target branches