From 6d412fd8e77a7b0f49a96bf9d2bbf0e4a39458bf Mon Sep 17 00:00:00 2001 From: "Christian M. Adams" Date: Tue, 27 Oct 2020 16:04:46 -0400 Subject: [PATCH] Properly record the license type when sub is a trial --- awx/main/utils/licensing.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awx/main/utils/licensing.py b/awx/main/utils/licensing.py index 67cbbd5978..d838e37e69 100644 --- a/awx/main/utils/licensing.py +++ b/awx/main/utils/licensing.py @@ -90,8 +90,8 @@ class OpenLicense(object): class Licenser(object): - # warn when there is a month (30 days) left on the license - LICENSE_TIMEOUT = 60 * 60 * 24 * 30 + # warn when there is a month (30 days) left on the subscription + SUBSCRIPTION_TIMEOUT = 60 * 60 * 24 * 30 UNLICENSED_DATA = dict( subscription_name=None, @@ -327,6 +327,7 @@ class Licenser(object): license._attrs['license_type'] = 'enterprise' if sub.trial: license._attrs['trial'] = True + license._attrs['license_type'] = 'trial' license._attrs['instance_count'] = min( MAX_INSTANCES, license._attrs['instance_count'] ) @@ -384,6 +385,6 @@ class Licenser(object): else: attrs['grace_period_remaining'] = (license_date + 2592000) - current_date attrs['compliant'] = bool(time_remaining > 0 and free_instances >= 0) - attrs['date_warning'] = bool(time_remaining < self.LICENSE_TIMEOUT) + attrs['date_warning'] = bool(time_remaining < self.SUBSCRIPTION_TIMEOUT) attrs['date_expired'] = bool(time_remaining <= 0) return attrs