mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-17 05:21:49 -05:00
Refactor Tower HA Instance logic and models
* Gut the HA middleware * Purge concept of primary and secondary. * UUID is not the primary host identifier, now it's based mostly on the username. Some work probably still left to do to make sure this is legit. Also removed unique constraint from the uuid field. This might become the cluster ident now... or it may just deprecate * No more secondary -> primary redirection * Initial revision of /api/v1/ping * Revise and gut tower-manage register_instance * Rename awx/main/socket.py to awx/main/socket_queue.py to prevent conflict with the "socket" module from python base * Revist/gut the Instance manager... not sure if this manager is really needed anymore
This commit is contained in:
@@ -166,28 +166,13 @@ class ApiV1PingView(APIView):
|
||||
# Most of this response is canned; just build the dictionary.
|
||||
response = {
|
||||
'ha': is_ha_environment(),
|
||||
'role': Instance.objects.my_role(),
|
||||
'version': get_awx_version(),
|
||||
}
|
||||
|
||||
# If this is an HA environment, we also include the IP address of
|
||||
# all of the instances.
|
||||
#
|
||||
# Set up a default structure.
|
||||
response['instances'] = {
|
||||
'primary': None,
|
||||
'secondaries': [],
|
||||
}
|
||||
|
||||
# Add all of the instances into the structure.
|
||||
response['instances'] = []
|
||||
for instance in Instance.objects.all():
|
||||
if instance.primary:
|
||||
response['instances']['primary'] = instance.hostname
|
||||
else:
|
||||
response['instances']['secondaries'].append(instance.hostname)
|
||||
response['instances']['secondaries'].sort()
|
||||
|
||||
# Done; return the response.
|
||||
response['instances'].append(instance.hostname)
|
||||
response['instances'].sort()
|
||||
return Response(response)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user