diff --git a/awx/api/views.py b/awx/api/views.py index 02a10451d8..eb7cf9d64e 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -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) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index b8bb60905b..1ad8524240 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -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':