summaryrefslogtreecommitdiff
diff options
-rwxr-xr-xhooks/hooks.py23
l---------hooks/upgrade-charm1
2 files changed, 13 insertions, 11 deletions
diff --git a/hooks/hooks.py b/hooks/hooks.py
index 6f82838..f8392d0 100755
--- a/hooks/hooks.py
+++ b/hooks/hooks.py
@@ -598,11 +598,11 @@ def remove_replset_from_upstart():
"""
try:
mongodb_init_config = open(default_mongodb_init_config).read()
- if re.search(' --replSet ',
- mongodb_init_config, re.MULTILINE) is not None:
- mongodb_init_config = regex_sub([
- (' --replSet ', ' ')
- ], mongodb_init_config)
+
+ if re.search(' --replSet', mongodb_init_config,
+ re.MULTILINE) is not None:
+ mongodb_init_config = re.sub(' --replSet .\w+', '',
+ mongodb_init_config)
retVal = update_file(default_mongodb_init_config, mongodb_init_config)
except Exception, e:
juju_log(str(e))
@@ -610,14 +610,14 @@ def remove_replset_from_upstart():
finally:
return(retVal)
+
def remove_rest_from_upstart():
"""Removes --rest from upstart script
"""
try:
mongodb_init_config = open(default_mongodb_init_config).read()
- if re.search(' --rest ',
- mongodb_init_config,
- re.MULTILINE) is not None:
+ if re.search(' --rest ', mongodb_init_config,
+ re.MULTILINE) is not None:
mongodb_init_config = regex_sub([(' --rest ', ' ')],
mongodb_init_config)
retVal = update_file(default_mongodb_init_config, mongodb_init_config)
@@ -627,6 +627,7 @@ def remove_rest_from_upstart():
finally:
return(retVal)
+
def update_daemon_options(daemon_options=None):
mongodb_init_config = open(default_mongodb_init_config).read()
pat_replace = []
@@ -1435,12 +1436,12 @@ def update_nrpe_config():
nrpe.write()
+
@hooks.hook('upgrade-charm')
def uprade_charm():
- pass
-
- replset=config()['replicaset']
+ juju_log('upgrade-charm: removing --replset from upstart script')
remove_replset_from_upstart()
+ juju_log('upgrade-charm: removing --rest from upstart script')
remove_rest_from_upstart()
diff --git a/hooks/upgrade-charm b/hooks/upgrade-charm
new file mode 120000
index 0000000..9416ca6
--- /dev/null
+++ b/hooks/upgrade-charm
@@ -0,0 +1 @@
+hooks.py \ No newline at end of file