Merge pull request #1204 from chrismeyersfsu/fix-remove_mongo

remove the starting of mongo
This commit is contained in:
Chris Meyers 2016-03-10 07:34:37 -05:00
commit 3fde9050a4
2 changed files with 1 additions and 27 deletions

View File

@ -54,7 +54,7 @@ from social.backends.utils import load_backends
# AWX
from awx.main.task_engine import TaskSerializer, TASK_FILE, TEMPORARY_TASK_FILE
from awx.main.tasks import mongodb_control, send_notifications
from awx.main.tasks import send_notifications
from awx.main.access import get_user_queryset
from awx.main.ha import is_ha_environment
from awx.api.authentication import TaskAuthentication, TokenGetAuthentication
@ -274,7 +274,6 @@ class ApiV1ConfigView(APIView):
# Only stop mongod if license removal succeeded
if has_error is None:
mongodb_control.delay('stop')
return Response(status=status.HTTP_204_NO_CONTENT)
else:
return Response({"error": "Failed to remove license (%s)" % has_error}, status=status.HTTP_400_BAD_REQUEST)

View File

@ -14,7 +14,6 @@ import pipes
import re
import shutil
import stat
import subprocess
import tempfile
import thread
import time
@ -180,30 +179,6 @@ def notify_task_runner(metadata_dict):
queue = FifoQueue('tower_task_manager')
queue.push(metadata_dict)
@task()
def mongodb_control(cmd):
# Sanity check: Do not send arbitrary commands.
if cmd not in ('start', 'stop'):
raise ValueError('Only "start" and "stop" are allowed.')
# Either start or stop mongo, as requested.
p = subprocess.Popen('sudo service mongod %s' % cmd, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
p.wait()
# Check to make sure the stop actually succeeded
p = subprocess.Popen('pidof mongod', shell=True)
shutdown_failed = p.wait() == 0
# If there was an error, log it.
if err:
logger.error(err)
if cmd == 'stop' and shutdown_failed:
p = subprocess.Popen('sudo mongod --shutdown -f /etc/mongod.conf', shell=True)
p.wait()
@task(bind=True)
def handle_work_success(self, result, task_actual):
if task_actual['type'] == 'project_update':