From 9b12d88e8c07324c9a6b92a842ce7ce49d20fda3 Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Wed, 2 Aug 2017 12:21:53 -0400 Subject: [PATCH] lay the foundation for checking license on upgrade --- awx/main/management/commands/check_license.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 awx/main/management/commands/check_license.py diff --git a/awx/main/management/commands/check_license.py b/awx/main/management/commands/check_license.py new file mode 100644 index 0000000000..8b67bd71e6 --- /dev/null +++ b/awx/main/management/commands/check_license.py @@ -0,0 +1,20 @@ +# Copyright (c) 2015 Ansible, Inc. +# All Rights Reserved + +from awx.main.utils import get_licenser +from django.core.management.base import NoArgsCommand + + +class Command(NoArgsCommand): + """Return 0 if licensed; 1 if unlicensed + """ + + def handle(self, **options): + super(Command, self).__init__() + + license_info = get_licenser().validate() + if license_info['valid_key'] is True: + return 0 + else: + return 1 +