Merge lp:~jjo/charms/trusty/mongodb/jjo-lp1274947-use_private-address_at_rs-initiate into lp:charms/trusty/mongodb

Proposed by JuanJo Ciarlante
Status: Work in progress
Proposed branch: lp:~jjo/charms/trusty/mongodb/jjo-lp1274947-use_private-address_at_rs-initiate
Merge into: lp:charms/trusty/mongodb
Diff against target: 19 lines (+9/-1)
1 file modified
hooks/hooks.py (+9/-1)
To merge this branch: bzr merge lp:~jjo/charms/trusty/mongodb/jjo-lp1274947-use_private-address_at_rs-initiate
Reviewer Review Type Date Requested Status
Review Queue (community) automated testing Needs Fixing
Cory Johns (community) Approve
charmers Pending
Review via email: mp+236599@code.launchpad.net
To post a comment you must log in.
55. By JuanJo Ciarlante

fix bracing for .format()

Revision history for this message
JuanJo Ciarlante (jjo) wrote :

Should cope with mongo rs.initiate() on hosts with 'invalid' hostname (see lp#1274947), I'm manually fixing them after deployment with: https://gist.github.com/jjo/198e27c8e44f68724fcd - this MP tries to implement that in-charm.

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
charm_lint_check #806 trusty-mongodb for jjo mp236599
    LINT FAIL: lint-check missing

LINT Results not found.
Build: http://10.98.191.181:8080/job/charm_lint_check/806/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

UOSCI bot says:
charm_unit_test #614 trusty-mongodb for jjo mp236599
    UNIT FAIL: unit-test missing

UNIT Results not found.
Build: http://10.98.191.181:8080/job/charm_unit_test/614/

Revision history for this message
Cory Johns (johnsca) wrote :

This seems fine to me, but I'm not clear how best to test this. Should I be able to replicate this on local provider, or does it require the MAAS bug? It would be best if we could "fudge" this enough to add a test case for this, but that seems like it would be difficult, if not impossible, to achieve.

Anyway, it doesn't seem to have any issues in the normal (non-bug) case, so it gets my +1.

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-10466-results

review: Needs Fixing (automated testing)
Revision history for this message
Mario Splivalo (mariosplivalo) wrote :

This merge request was included here, as I needed it for fixing mongodb charm replicaset feature.

https://code.launchpad.net/~mariosplivalo/charms/trusty/mongodb/replsets-fix-try/+merge/243465

Unmerged revisions

55. By JuanJo Ciarlante

fix bracing for .format()

54. By JuanJo Ciarlante

[jjo] explicitly use private-address at rs.initiate()

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/hooks.py'
2--- hooks/hooks.py 2014-08-20 23:48:43 +0000
3+++ hooks/hooks.py 2014-09-30 20:28:11 +0000
4@@ -345,7 +345,15 @@
5 juju_log("init_replset: master_node must be defined.")
6 retVal = False
7 else:
8- retVal = mongo_client(master_node, 'rs.initiate()')
9+ config_data = config()
10+ # Use my IP at rs.initiate(), voids issues with invalid (and/or
11+ # not resolvable by peers) hostnames
12+ init_json = ('{{"_id": "{}", "members": '
13+ '[{{"_id": 0, "host": "{}:{}"}}]}}'.format(
14+ config_data['replicaset'],
15+ unit_get('private-address'),
16+ config_data['config_server_port']))
17+ retVal = mongo_client(master_node, 'rs.initiate(%s)' % init_json)
18 juju_log("init_replset returns: %s" % retVal)
19 return(retVal)
20

Subscribers

People subscribed via source and target branches