mirror of
https://github.com/ansible/awx.git
synced 2026-04-09 20:19:21 -02:30
Surface errors when launching jobs through Receptor
This will raise errors such as: exec: "ansible-runner": executable file not found in $PATH
This commit is contained in:
committed by
Shane McDonald
parent
fd92ba0c0b
commit
be8168b555
@@ -1529,10 +1529,12 @@ class BaseTask(object):
|
|||||||
receptor_ctl = ReceptorControl('/var/run/receptor/receptor.sock')
|
receptor_ctl = ReceptorControl('/var/run/receptor/receptor.sock')
|
||||||
result = receptor_ctl.submit_work(worktype=worktype,
|
result = receptor_ctl.submit_work(worktype=worktype,
|
||||||
payload=sockout.makefile('rb'))
|
payload=sockout.makefile('rb'))
|
||||||
|
unit_id = result['unitid']
|
||||||
|
|
||||||
sockin.close()
|
sockin.close()
|
||||||
sockout.close()
|
sockout.close()
|
||||||
|
|
||||||
resultsock, resultfile = receptor_ctl.get_work_results(result['unitid'],
|
resultsock, resultfile = receptor_ctl.get_work_results(unit_id,
|
||||||
return_socket=True,
|
return_socket=True,
|
||||||
return_sockfile=True)
|
return_sockfile=True)
|
||||||
|
|
||||||
@@ -1547,7 +1549,7 @@ class BaseTask(object):
|
|||||||
def cancel_watcher(processor_future):
|
def cancel_watcher(processor_future):
|
||||||
while True:
|
while True:
|
||||||
if processor_future.done():
|
if processor_future.done():
|
||||||
return
|
return processor_future.result()
|
||||||
|
|
||||||
if self.cancel_callback():
|
if self.cancel_callback():
|
||||||
result = namedtuple('result', ['status', 'rc'])
|
result = namedtuple('result', ['status', 'rc'])
|
||||||
@@ -1569,11 +1571,15 @@ class BaseTask(object):
|
|||||||
|
|
||||||
res = list(first_future.done)[0].result()
|
res = list(first_future.done)[0].result()
|
||||||
if res.status == 'canceled':
|
if res.status == 'canceled':
|
||||||
receptor_ctl.simple_command(f"work cancel {result['unitid']}")
|
receptor_ctl.simple_command(f"work cancel {unit_id}")
|
||||||
resultsock.shutdown(socket.SHUT_RDWR)
|
resultsock.shutdown(socket.SHUT_RDWR)
|
||||||
resultfile.close()
|
resultfile.close()
|
||||||
|
elif res.status == 'error':
|
||||||
|
# TODO: There should be a more efficient way of getting this information
|
||||||
|
receptor_work_list = receptor_ctl.simple_command("work list")
|
||||||
|
raise RuntimeError(receptor_work_list[unit_id]['Detail'])
|
||||||
|
|
||||||
receptor_ctl.simple_command(f"work release {result['unitid']}")
|
receptor_ctl.simple_command(f"work release {unit_id}")
|
||||||
status = res.status
|
status = res.status
|
||||||
rc = res.rc
|
rc = res.rc
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user