diff options
| author | Mario Splivalo <mario.splivalo@canonical.com> | 2016-12-13 08:19:32 +0100 |
|---|---|---|
| committer | Mario Splivalo <mario.splivalo@canonical.com> | 2016-12-13 08:19:32 +0100 |
| commit | 27dd6460945f21044f79ab6d8c39d4b000877130 (patch) | |
| tree | dbfdb34f51cb96f96027867172cc54b4027ed164 | |
| parent | 78e83cd59d0abb57cedddd1e378eed161d477132 (diff) | |
Code cleanup
| -rwxr-xr-x | hooks/hooks.py | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/hooks/hooks.py b/hooks/hooks.py index 5f317e0..6f82838 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -329,12 +329,8 @@ def mongodb_conf(config_data=None): config.append("") # nohttpinterface - if not config_data['web_admin_ui']: - #config.append("nohttpinterface = true") - config.append("") - else: + if config_data['web_admin_ui']: config.append("rest = true") - #config.append("httpinterface = true") config.append("") # noscripting @@ -574,8 +570,7 @@ def enable_replset(replicaset_name=None): juju_log('enable_replset: replicaset_name is None, exiting', level=DEBUG) try: - juju_log('enable_replset: trying to get lock on: %s' % - default_mongodb_init_config) + juju_log('enable_replset: Enabling replicaset configuration:') current_config = get_current_mongo_config() config_data = config() @@ -598,17 +593,15 @@ def enable_replset(replicaset_name=None): finally: return retVal -def remove_replset_from_upstart(replicaset_name=None): +def remove_replset_from_upstart(): """Removes replicaset configuration from upstart. """ - if replicaset_name is None: - retVal = False try: mongodb_init_config = open(default_mongodb_init_config).read() - if re.search(' --replSet %s ' % replicaset_name, + if re.search(' --replSet ', mongodb_init_config, re.MULTILINE) is not None: mongodb_init_config = regex_sub([ - (' --replSet %s ' % replicaset_name, ' ') + (' --replSet ', ' ') ], mongodb_init_config) retVal = update_file(default_mongodb_init_config, mongodb_init_config) except Exception, e: @@ -1447,7 +1440,7 @@ def uprade_charm(): pass replset=config()['replicaset'] - remove_replset_from_upstart(replset) + remove_replset_from_upstart() remove_rest_from_upstart() |
