From 40d5142d11b8c628c19be9998c15f61c684c3a3a Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Fri, 9 Dec 2016 14:19:41 -0500 Subject: [PATCH] remove more mongo things --- awx/api/management/commands/uses_mongo.py | 58 ----------------------- 1 file changed, 58 deletions(-) delete mode 100644 awx/api/management/commands/uses_mongo.py diff --git a/awx/api/management/commands/uses_mongo.py b/awx/api/management/commands/uses_mongo.py deleted file mode 100644 index 6f77ee47fa..0000000000 --- a/awx/api/management/commands/uses_mongo.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (c) 2015 Ansible, Inc. -# All Rights Reserved - -import sys - -from optparse import make_option -from django.core.management.base import BaseCommand -from awx.main.ha import is_ha_environment -from awx.main.task_engine import TaskEnhancer - - -class Command(BaseCommand): - """Return a exit status of 0 if MongoDB should be active, and an - exit status of 1 otherwise. - - This script is intended to be used by bash and init scripts to - conditionally start MongoDB, so its focus is on being bash-friendly. - """ - - def __init__(self): - super(Command, self).__init__() - BaseCommand.option_list += (make_option('--local', - dest='local', - default=False, - action="store_true", - help="Only check if mongo should be running locally"),) - - def handle(self, *args, **kwargs): - # Get the license data. - license_data = TaskEnhancer().validate_enhancements() - - # Does the license have features, at all? - # If there is no license yet, then all features are clearly off. - if 'features' not in license_data: - print('No license available.') - sys.exit(2) - - # Does the license contain the system tracking feature? - # If and only if it does, MongoDB should run. - system_tracking = license_data['features']['system_tracking'] - - # Okay, do we need MongoDB to be turned on? - # This is a silly variable assignment right now, but I expect the - # rules here will grow more complicated over time. - uses_mongo = system_tracking # noqa - - if is_ha_environment() and kwargs['local'] and uses_mongo: - print("HA Configuration detected. Database should be remote") - uses_mongo = False - - # If we do not need Mongo, return a non-zero exit status. - if not uses_mongo: - print('MongoDB NOT required') - sys.exit(1) - - # We do need Mongo, return zero. - print('MongoDB required') - sys.exit(0)