Skip to content

Commit

Permalink
Register system again if deleted by another pod
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Jul 8, 2022
1 parent 401b30b commit 9f2c9d6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion awx/main/tasks/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,13 @@ def cluster_node_heartbeat():
logger.warning('Rejoining the cluster as instance {}.'.format(this_inst.hostname))
return
else:
raise RuntimeError("Cluster Host Not Found: {}".format(settings.CLUSTER_HOST_ID))
if settings.AWX_AUTO_DEPROVISION_INSTANCES:
(changed, this_inst) = Instance.objects.register(ip_address=os.environ.get('MY_POD_IP'), node_type='control', uuid=settings.SYSTEM_UUID)
if changed:
logger.warning(f'Recreated instance record {this_inst.hostname} after unexpected removal')
this_inst.local_health_check()
else:
raise RuntimeError("Cluster Host Not Found: {}".format(settings.CLUSTER_HOST_ID))
# IFF any node has a greater version than we do, then we'll shutdown services
for other_inst in instance_list:
if other_inst.node_type in ('execution', 'hop'):
Expand Down

0 comments on commit 9f2c9d6

Please sign in to comment.