Skip to content

Commit 812ecaf

Browse files
committed
Merge pull request alphagov#137 from alphagov/add-mongodb-remount-task
Add a Fabric task to mount encrypted MongoDB drive
2 parents e16816f + a37dc35 commit 812ecaf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

mongo.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,16 @@ def safe_reboot():
211211
abort("Cluster has not recovered")
212212

213213
execute(vm.reboot, hosts=[env['host_string']])
214+
215+
216+
@task
217+
def mount_licensify_encrypted_drive():
218+
with settings(ok_ret_codes=[0, 1]):
219+
result = run('grep /var/lib/mongodb /proc/mounts')
220+
if result.return_code == 0:
221+
exit('/var/lib/mongodb is already mounted on this host.')
222+
with settings(warn_only=True):
223+
sudo('service mongodb stop')
224+
sudo('rm -rf /var/lib/mongodb/*')
225+
sudo('mount /var/lib/mongodb')
226+
sudo('service mongodb start')

0 commit comments

Comments
 (0)