Remove the auto-discovery feature

This commit is contained in:
Jeff Bradberry 2022-01-07 14:27:17 -05:00
parent fc2a5224ef
commit f1c5da7026
3 changed files with 1 additions and 29 deletions

View File

@ -67,7 +67,6 @@ from awx.main.models import (
TowerScheduleState,
Instance,
InstanceGroup,
InstanceLink,
UnifiedJob,
Notification,
Inventory,
@ -505,21 +504,12 @@ def inspect_execution_nodes(instance_list):
workers = mesh_status['Advertisements']
for ad in workers:
hostname = ad['NodeID']
if ad.get('WorkCommands') is None:
node_type = 'hop'
elif any(cmd['WorkType'] == 'ansible-runner' for cmd in ad['WorkCommands'] or []):
node_type = 'execution'
else:
if not any(cmd['WorkType'] == 'ansible-runner' for cmd in ad['WorkCommands'] or []):
continue
changed = False
if hostname in node_lookup:
instance = node_lookup[hostname]
elif settings.MESH_AUTODISCOVERY_ENABLED:
defaults = dict(enabled=False)
(changed, instance) = Instance.objects.register(hostname=hostname, node_type=node_type, defaults=defaults)
node_lookup[hostname] = instance
logger.warn(f"Registered execution node '{hostname}' (marked disabled by default)")
else:
logger.warn(f"Unrecognized node on mesh advertising ansible-runner work type: {hostname}")
continue
@ -548,17 +538,6 @@ def inspect_execution_nodes(instance_list):
logger.debug(f'Restarting health check for execution node {hostname} with known errors.')
execution_node_health_check.apply_async([hostname])
links = {tuple(sorted((node, peer))) for node, peers in mesh_status['KnownConnectionCosts'].items() for peer in peers}
for a, b in links:
if a not in node_lookup:
logger.warn(f"Cannot link {a} to {b}: {a} not registered.")
continue
if b not in node_lookup:
logger.warn(f"Cannot link {a} to {b}: {b} not registered.")
continue
a_obj, b_obj = node_lookup[a], node_lookup[b]
InstanceLink.objects.get_or_create(source=a_obj, target=b_obj)
@task(queue=get_local_queuename)
def cluster_node_heartbeat():

View File

@ -262,10 +262,6 @@ CSRF_COOKIE_SECURE = True
# Limit CSRF cookies to browser sessions
CSRF_COOKIE_AGE = None
# Auto-discover new instances that appear on receptor mesh
# used for docker-compose environment, unsupported
MESH_AUTODISCOVERY_ENABLED = False
TEMPLATES = [
{
'NAME': 'default',

View File

@ -55,9 +55,6 @@ template['OPTIONS']['loaders'] = ('django.template.loaders.filesystem.Loader', '
PENDO_TRACKING_STATE = "off"
INSIGHTS_TRACKING_STATE = False
# auto-discover receptor-* execution nodes
MESH_AUTODISCOVERY_ENABLED = True
# debug toolbar and swagger assume that requirements/requirements_dev.txt are installed
INSTALLED_APPS += ['rest_framework_swagger', 'debug_toolbar'] # NOQA