Repository navigation
Description
ISSUE TYPE
- Bug Report
SUMMARY
When running a job in a container group the job returns with status error and a stack trace in the error details field. The same Job runs perfectly when not run in a container group.
status: error
error details: Traceback (most recent call last): File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/tasks.py", line 1401, in run ident=str(self.instance.pk)) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/isolated/manager.py", line 432, in run status, rc = self.check() File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/isolated/manager.py", line 241, in check self.consume_events(dispatcher) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/isolated/manager.py", line 306, in consume_events event_data.setdefault(self.event_data_key, self.instance.id) UnboundLocalError: local variable 'event_data' referenced before assignment
ENVIRONMENT
- AWX version: 9.3.0
- AWX install method: kubernetes
- Ansible version: 2.9.5
- Operating System: linux
- Web Browser: chromium
STEPS TO REPRODUCE
setup a job template in a container group and run it. This error does not always happen it seems to only happen against specific inventories.
EXPECTED RESULTS
I expected the job to return with no error as it does when not run in a container-instance.
ACTUAL RESULTS
status: error
error details:
Traceback (most recent call last): File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/tasks.py", line 1401, in run ident=str(self.instance.pk)) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/isolated/manager.py", line 432, in run status, rc = self.check() File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/isolated/manager.py", line 241, in check self.consume_events(dispatcher) File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/isolated/manager.py", line 306, in consume_events event_data.setdefault(self.event_data_key, self.instance.id) UnboundLocalError: local variable 'event_data' referenced before assignment
ADDITIONAL INFORMATION
Here is some more info from the logs:
2020-03-12 23:43:10,040 ERROR awx.isolated.manager.playbooks
PLAY [Poll for status of active job.] ******************************************
TASK [Determine if daemon process is alive.] ***********************************
changed: [awx-job-164]
TASK [Copy artifacts from the isolated host.] **********************************
skipping: [awx-job-164]
TASK [Copy daemon log from the isolated host] **********************************
skipping: [awx-job-164]
TASK [Copy artifacts from pod] *************************************************
2020-03-12 23:43:10,042 ERROR awx.main.tasks job 164 (running) Exception occurred while running task
Traceback (most recent call last):
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/tasks.py", line 1401, in run
ident=str(self.instance.pk))
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/isolated/manager.py", line 432, in run
status, rc = self.check()
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/isolated/manager.py", line 241, in check
self.consume_events(dispatcher)
File "/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/isolated/manager.py", line 294, in consume_events
open(os.path.join(events_path, event), 'r')
IsADirectoryError: [Errno 21] Is a directory: '/tmp/awx_164_pojd2p9l/artifacts/164/job_events/.~tmp~'
2020-03-12 23:43:10,044 DEBUG awx.main.tasks job 164 (running) finished running, producing 0 events.
Activity
fix a bug in isolated event handling
kdelee commentedon Mar 17, 2020
This looks good,
continuedoes the right thing and goes to next iteration, whereaspasswas having us go on to https://github.com/ryanpetrello/awx/blob/b73e8d8a567cbb7206fcb08a8db9919de23b7eb2/awx/main/isolated/manager.py#L305 and referenceevent_datawhen that did not exist -- causing this error. I'm going to call this good as @nixocio have investigated and works for usdomq commentedon Apr 13, 2020
Regarding specifically the
IsADirectoryError, see also #6675