Error handling when node is missing from mesh for jobs and checks

This commit is contained in:
Alan Rominger
2021-10-15 11:23:38 -04:00
committed by Shane McDonald
parent 206c85778e
commit f34c96ecf5
3 changed files with 15 additions and 3 deletions

View File

@@ -1,12 +1,14 @@
import logging
import yaml
import time
from enum import Enum, unique
from receptorctl.socket_interface import ReceptorControl
from awx.main.exceptions import ReceptorNodeNotFound
from django.conf import settings
from enum import Enum, unique
logger = logging.getLogger('awx.main.utils.receptor')
@@ -63,6 +65,7 @@ def get_conn_type(node_name, receptor_ctl):
for node in all_nodes:
if node.get('NodeID') == node_name:
return ReceptorConnectionType(node.get('ConnType'))
raise ReceptorNodeNotFound(f'Instance {node_name} is not in the receptor mesh')
def administrative_workunit_reaper(work_list=None):
@@ -183,6 +186,9 @@ def worker_info(node_name, work_type='ansible-runner'):
else:
error_list.append(details)
except ReceptorNodeNotFound as exc:
error_list.append(str(exc))
# If we have a connection error, missing keys would be trivial consequence of that
if not data['errors']:
# see tasks.py usage of keys