Disable cleanup_facts if the user does not have system tracking enabled

in their license file
This commit is contained in:
Matthew Jones 2015-06-01 10:30:22 -04:00
parent 9c7943039c
commit 8006066609

View File

@ -13,6 +13,7 @@ from django.utils.timezone import now
# AWX
from awx.fact.models.fact import * # noqa
from awx.api.license import feature_enabled
OLDER_THAN = 'older_than'
GRANULARITY = 'granularity'
@ -129,6 +130,8 @@ class Command(BaseCommand):
@transaction.atomic
def handle(self, *args, **options):
if not feature_enabled('system_tracking'):
raise CommandError("The System Tracking feature is not enabled for your Tower instance")
cleanup_facts = CleanupFacts()
if not all([options[GRANULARITY], options[OLDER_THAN]]):
raise CommandError('Both --granularity and --older_than are required.')