Skip to content

fix: skip mongo code if database has already been provisioned

Keith Grootboom requested to merge keith/skip-mongo-provisioning into master

Description

Updates the MongoDB provisioning so that it doesn't happen more than once.

This will fix the issues encountered in https://tasks.opencraft.com/browse/SE-5692

Testing instructions

I've set up a test instance https://stage.manage.opencraft.com/instance/9610/edx-appserver/3776/

  • SSH into the active appserver
  • Restart the forum /edx/bin/supervisorctl restart forum
  • Hit the heartbeat URL: curl --insecure https://mongo-scram-fix.stage.opencraft.hosting/heartbeat?extended.

At this stage it will pass.

  • Restart the forum again
  • Start a Django shell on stage.manage.opencraft.com and run the below.
instance = InstanceReference.objects.get(pk=9610).instance
instance.provision_mongo()
  • Hit the heartbeat URL again: curl --insecure https://mongo-scram-fix.stage.opencraft.hosting/heartbeat?extended.
  • This time it will fail

_Do the above again, but with the branch checked out git checkout origin/keith/skip-mongo-provisioning (don't forget to restart the Django shell) and you will not get the heartbeat failure.

Edited by Keith Grootboom

Merge request reports