From 43491721b6fcae5433eb803fb9d6db3ecd321a99 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Fri, 21 Feb 2014 11:40:04 -0500 Subject: [PATCH] Fix issue AC-1008... not checking license expiration when running import inventory --- awx/main/management/commands/inventory_import.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/awx/main/management/commands/inventory_import.py b/awx/main/management/commands/inventory_import.py index 7dbf0e8d5b..6669d9ac1f 100644 --- a/awx/main/management/commands/inventory_import.py +++ b/awx/main/management/commands/inventory_import.py @@ -702,7 +702,11 @@ class Command(NoArgsCommand): license_info = reader.from_file() available_instances = license_info.get('available_instances', 0) free_instances = license_info.get('free_instances', 0) + time_remaining = license_info.get('time_remaining', 0) new_count = Host.objects.filter(active=True).count() + if time_remaining <= 0: + self.logger.error('License has expired') + raise CommandError("License has expired!") if free_instances < 0: d = { 'new_count': new_count, @@ -737,6 +741,7 @@ class Command(NoArgsCommand): if not self.source: raise CommandError('--source is required') + self.check_license() begin = time.time() self.load_inventory_from_database()