Properly record the license type when sub is a trial

This commit is contained in:
Christian M. Adams
2020-10-27 16:04:46 -04:00
parent ddcbb1f9c2
commit 6d412fd8e7

View File

@@ -90,8 +90,8 @@ class OpenLicense(object):
class Licenser(object): class Licenser(object):
# warn when there is a month (30 days) left on the license # warn when there is a month (30 days) left on the subscription
LICENSE_TIMEOUT = 60 * 60 * 24 * 30 SUBSCRIPTION_TIMEOUT = 60 * 60 * 24 * 30
UNLICENSED_DATA = dict( UNLICENSED_DATA = dict(
subscription_name=None, subscription_name=None,
@@ -327,6 +327,7 @@ class Licenser(object):
license._attrs['license_type'] = 'enterprise' license._attrs['license_type'] = 'enterprise'
if sub.trial: if sub.trial:
license._attrs['trial'] = True license._attrs['trial'] = True
license._attrs['license_type'] = 'trial'
license._attrs['instance_count'] = min( license._attrs['instance_count'] = min(
MAX_INSTANCES, license._attrs['instance_count'] MAX_INSTANCES, license._attrs['instance_count']
) )
@@ -384,6 +385,6 @@ class Licenser(object):
else: else:
attrs['grace_period_remaining'] = (license_date + 2592000) - current_date attrs['grace_period_remaining'] = (license_date + 2592000) - current_date
attrs['compliant'] = bool(time_remaining > 0 and free_instances >= 0) 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) attrs['date_expired'] = bool(time_remaining <= 0)
return attrs return attrs