awx/awx/main/ha.py
Alan Rominger e52416fd47
Report single node clusters as non-ha (#11212)
* Report single node clusters as non-ha

* Move test file so we can make it use the database

* Update unit test to accomidate different node types
2021-10-06 10:50:18 -04:00

16 lines
405 B
Python

# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# AWX
from awx.main.models import Instance
def is_ha_environment():
"""Return True if this is an HA environment, and False
otherwise.
"""
# If there are two or more instances, then we are in an HA environment.
if Instance.objects.filter(node_type__in=('control', 'hybrid')).count() > 1:
return True
return False