diff options
author | Drew Freiberger <drew.freiberger@canonical.com> | 2018-10-31 17:03:06 -0500 |
---|---|---|
committer | Drew Freiberger <drew.freiberger@canonical.com> | 2018-10-31 17:03:06 -0500 |
commit | 4f9b946b2afe3f2eaa179beaab8d5929eed19270 (patch) | |
tree | 412e3775cd19487de5ae160a4b49dcc4aea49be7 | |
parent | 7b2828638b3dad83776fef60b0dc96825ec4e10e (diff) |
Ensure bind_ip=all listens externally on bionic
Mongodb by default on bionic only listens on localhost, which means no relations to mongodb can connect to the database by default when using charm default configs of bind_ip=all and replicaset_master=auto. This issue was mitigated for HA deployments of mongodb in commit 7b2828638b3dad83776fef60b0dc96825ec4e10e, but did not solve client connectivity. This patch resolves the issue for HA and non HA deploys. Closes-Bug: #1800208
-rwxr-xr-x | hooks/hooks.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/hooks/hooks.py b/hooks/hooks.py index ec4adfb..93d8329 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -275,7 +275,10 @@ def mongodb_conf(config_data=None): # bind_ip if config_data['bind_ip'] != "all": config.append("bind_ip = %s" % config_data['bind_ip']) - config.append("") + elif is_bionic_or_greater(): + config_data['bind_ip'] = '0.0.0.0' + config.append("") + # port config.append("port = %d" % config_data['port']) @@ -573,10 +576,6 @@ def enable_replset(replicaset_name=None): current_config = get_current_mongo_config() config_data = dict(config()) - if is_bionic_or_greater(): - if config_data['bind_ip'] == "all": - config_data['bind_ip'] = '0.0.0.0' - if 'replSet' in current_config and \ current_config['replSet'] == config_data['replicaset']: juju_log('enable_replset: replica set is already enabled', |