diff --git a/awx/main/utils/licensing.py b/awx/main/utils/licensing.py index 4890b1015c85..7453f56c81d1 100644 --- a/awx/main/utils/licensing.py +++ b/awx/main/utils/licensing.py @@ -450,7 +450,12 @@ def validate(self): if first_host: automated_since = int(first_host.first_automation.timestamp()) else: - automated_since = int(Instance.objects.order_by('id').first().created.timestamp()) + try: + automated_since = int(Instance.objects.order_by('id').first().created.timestamp()) + except AttributeError: + # In the odd scenario that create_preload_data was not run, there are no hosts + # Then we CAN end up here before any instance has registered + automated_since = int(time.time()) instance_count = int(attrs.get('instance_count', 0)) attrs['current_instances'] = current_instances attrs['automated_instances'] = automated_instances