Why I am Unable to delete canceled Workflow job in Ansible Automation Platform?

Solution Verified - Updated -

Environment

  • Red Hat® Ansible Automation Platform 2.x

Issue

  • In Ansible Automation Platform GUI, deleting the canceled workflow job fails with the error KeyError: 'main_workflowjob'

Resolution

  • This is known issue and has been reported to Red Hat Engineering.

  • It is being tracked in JIRA AAP-7965. For more information, please open a new support case with Red Hat Support.

Workaround:

  • Access the shell plus console and execute the below query:

    # awx-manage shell_plus
    >>> UnifiedJob.objects.filter(id=N).delete()        - N being the id of the workflow job log
    

Diagnostic Steps

  • The following error message can be seen in /var/log/tower/tower.log while deleting the canceled workflow job from GUI:

    Error while deleting from AAP GUI:
    
    DELETE api/v2/workflow_jobs/<ID>/ 500
    A server error has occured
    
    
    Output from tower.log:
    Traceback (most recent call last):
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
    File "/usr/lib64/python3.9/contextlib.py", line 79, in inner
    return func(*args, **kwds)
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/api/generics.py", line 338, in dispatch
    return super(APIView, self).dispatch(request, *args, **kwargs)
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/rest_framework/generics.py", line 217, in delete
    return self.destroy(request, *args, **kwargs)
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/api/views/mixin.py", line 57, in destroy
    obj.get_event_queryset().delete()
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/unified_jobs.py", line 1057, in get_event_queryset
    self.event_parent_key: self.id,
    File "/app/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/models/unified_jobs.py", line 1042, in event_parent_key
    return {
    KeyError: 'main_workflowjob'
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments