Merge lp:~evarlast/charms/trusty/mongodb/i-do-not-know-how-to-use-bzr-so-i-pushed-here into lp:charms/trusty/mongodb

Proposed by Jay R. Wren
Status: Merged
Merged at revision: 56
Proposed branch: lp:~evarlast/charms/trusty/mongodb/i-do-not-know-how-to-use-bzr-so-i-pushed-here
Merge into: lp:charms/trusty/mongodb
Diff against target: 127 lines (+15/-13)
1 file modified
hooks/hooks.py (+15/-13)
To merge this branch: bzr merge lp:~evarlast/charms/trusty/mongodb/i-do-not-know-how-to-use-bzr-so-i-pushed-here
Reviewer Review Type Date Requested Status
Jorge Niedbalski (community) Approve
Tim Van Steenburgh (community) Approve
Review Queue (community) automated testing Needs Fixing
dann frazier Pending
Charles Butler Pending
Review via email: mp+240499@code.launchpad.net

Description of the change

Mongodb charm is broken on ec2 and azure and presumably any cloud which configures its network such that public addresses are not accessible from the inside private address range.

This change prefers the use of private address instead of public address.

To post a comment you must log in.
Revision history for this message
Jay R. Wren (evarlast) wrote :

Updated MR with a merged branch.

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

UOSCI bot says:
charm_amulet_test #338 trusty-mongodb for evarlast mp240499
    AMULET FAIL: amulet-test missing

AMULET Results (max last 5 lines):
INFO:root:Workspace dir: /var/lib/jenkins/workspace/charm_amulet_test
INFO:root:Reading file: Makefile
INFO:root:Searching for: ['@juju test']
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/8807862/
Build: http://10.98.191.181:8080/job/charm_amulet_test/338/

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

UOSCI bot says:
charm_unit_test #755 trusty-mongodb for evarlast mp240499
    UNIT OK: passed

UNIT Results (max last 5 lines):
INFO:root:command: make -f Makefile unittest
  tests/10-unit.test
  test_success (test_write_log_rotate_config.TestWriteLogrotateConfigFile) ... ok
  Ran 1 test in 0.003s
  OK

Full unit test output: http://paste.ubuntu.com/8807863/
Build: http://10.98.191.181:8080/job/charm_unit_test/755/

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

UOSCI bot says:
charm_lint_check #920 trusty-mongodb for evarlast mp240499
    LINT FAIL: lint-test missing

LINT Results (max last 5 lines):
INFO:root:Workspace dir: /var/lib/jenkins/workspace/charm_lint_check
INFO:root:Reading file: Makefile
INFO:root:Searching for: ['@flake8']
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full lint test output: http://paste.ubuntu.com/8807864/
Build: http://10.98.191.181:8080/job/charm_lint_check/920/

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

review: Needs Fixing (automated testing)
Revision history for this message
Tim Van Steenburgh (tvansteenburgh) wrote :

+1 LGTM, thanks Jay! I've tested this by merging it into https://code.launchpad.net/~tvansteenburgh/charms/trusty/mongodb/test-refactor/+merge/240740 and verifying that deployments succeed and tests pass.

review: Approve
Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

Before applying this patchset setting up a 3 nodes cluster was failing on OpenStack provider. After applying this change ( could be coincident ) it works as expected.

See the current output: https://gist.github.com/niedbalski/6e7cf829f68e9ae82966

Also tests are passing:

(env)niedbalski@theos-mobile:~/src/juju/charms/mongodb-trunk$ nosetests -s -v
test_success (test_write_log_rotate_config.TestWriteLogrotateConfigFile) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.034s

OK

Giving +1 to this change.

review: Approve

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-11-03 20:19:38 +0000
4@@ -468,14 +468,14 @@
5 current_try = 0
6 while (process_check_pidfile('/var/run/mongodb/configsvr.pid') !=
7 (None, None)) and not port_check(
8- unit_get('public-address'),
9+ unit_get('private-address'),
10 config_data['config_server_port']) and current_try < max_tries:
11 juju_log("configsvr_status: Waiting for Config Server to be ready ...")
12 time.sleep(wait_for)
13 current_try += 1
14 retVal = (
15 process_check_pidfile('/var/run/mongodb/configsvr.pid') != (None, None)
16- ) == port_check(unit_get('public-address'),
17+ ) == port_check(unit_get('private-address'),
18 config_data['config_server_port']) is True
19 if retVal:
20 return(process_check_pidfile('/var/run/mongodb/configsvr.pid'))
21@@ -558,14 +558,14 @@
22 current_try = 0
23 while (process_check_pidfile('/var/run/mongodb/mongos.pid') !=
24 (None, None)) and not port_check(
25- unit_get('public-address'),
26+ unit_get('private-address'),
27 config_data['mongos_port']) and current_try < max_tries:
28 juju_log("mongos_status: Waiting for Mongo shell to be ready ...")
29 time.sleep(wait_for)
30 current_try += 1
31 retVal = \
32 (process_check_pidfile('/var/run/mongodb/mongos.pid') !=
33- (None, None)) == port_check(unit_get('public-address'),
34+ (None, None)) == port_check(unit_get('private-address'),
35 config_data['mongos_port']) is True
36 if retVal:
37 return(process_check_pidfile('/var/run/mongodb/mongos.pid'))
38@@ -645,7 +645,7 @@
39
40
41 def restart_mongod(wait_for=default_wait_for, max_tries=default_max_tries):
42- my_hostname = unit_get('public-address')
43+ my_hostname = unit_get('private-address')
44 my_port = config('port')
45 current_try = 0
46
47@@ -776,6 +776,8 @@
48 print "current_mongodb_port: ", current_mongodb_port
49 public_address = unit_get('public-address')
50 print "public_address: ", public_address
51+ private_address = unit_get('private-address')
52+ print "private_address: ", private_address
53
54 # Update mongodb configuration file
55 mongodb_config = mongodb_conf(config_data)
56@@ -808,7 +810,7 @@
57
58 # attach to replSet ( if needed )
59 if config_data['replicaset_master'] != "auto":
60- join_replset(config_data['replicaset_master'], public_address)
61+ join_replset(config_data['replicaset_master'], private_address)
62
63 # arbiter
64 if config_data['replicaset_master'] != 'auto':
65@@ -816,7 +818,7 @@
66 config_data['replicaset_master'] != "auto":
67 if config_data['arbiter'] == 'enable':
68 enable_arbiter(config_data['replicaset_master'],
69- "%s:%s" % (public_address, config_data['port']))
70+ "%s:%s" % (private_address, config_data['port']))
71 else:
72 enable_arbiter(config_data['replicaset_master'],
73 config_data['arbiter'])
74@@ -892,7 +894,7 @@
75 @hooks.hook('database-relation-joined')
76 def database_relation_joined():
77 juju_log("database_relation_joined")
78- my_hostname = unit_get('public-address')
79+ my_hostname = unit_get('private-address')
80 my_port = config('port')
81 my_replset = config('replicaset')
82 juju_log("my_hostname: %s" % my_hostname)
83@@ -910,7 +912,7 @@
84 @hooks.hook('replicaset-relation-joined')
85 def replica_set_relation_joined():
86 juju_log("replica_set_relation_joined")
87- my_hostname = unit_get('public-address')
88+ my_hostname = unit_get('private-address')
89 my_port = config('port')
90 my_replset = config('replicaset')
91 my_install_order = os.environ['JUJU_UNIT_NAME'].split('/')[1]
92@@ -933,7 +935,7 @@
93 @hooks.hook('replicaset-relation-changed')
94 def replica_set_relation_changed():
95 juju_log("replica_set_relation_changed")
96- my_hostname = unit_get('public-address')
97+ my_hostname = unit_get('private-address')
98 my_port = config('port')
99 my_install_order = os.environ['JUJU_UNIT_NAME'].split('/')[1]
100 my_replicaset_master = config('replicaset_master')
101@@ -1014,7 +1016,7 @@
102 @hooks.hook('configsvr-relation-joined')
103 def configsvr_relation_joined():
104 juju_log("configsvr_relation_joined")
105- my_hostname = unit_get('public-address')
106+ my_hostname = unit_get('private-address')
107 my_port = config('config_server_port')
108 my_install_order = os.environ['JUJU_UNIT_NAME'].split('/')[1]
109 relation_set(relation_id(),
110@@ -1038,7 +1040,7 @@
111 @hooks.hook('mongos-relation-joined')
112 def mongos_relation_joined():
113 juju_log("mongos_relation_joined")
114- my_hostname = unit_get('public-address')
115+ my_hostname = unit_get('private-address')
116 my_port = config('mongos_port')
117 my_install_order = os.environ['JUJU_UNIT_NAME'].split('/')[1]
118 relation_set(relation_id(),
119@@ -1079,7 +1081,7 @@
120 elif rel_type == 'database':
121 if mongos_ready():
122 mongos_host = "%s:%s" % (
123- unit_get('public-address'),
124+ unit_get('private-address'),
125 config('mongos_port'))
126 shard_command1 = "sh.addShard(\"%s:%s\")" % (hostname, port)
127 mongo_client(mongos_host, shard_command1)

Subscribers

People subscribed via source and target branches