Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling / display when Ansible Runner errors #10025

Merged
merged 1 commit into from
Apr 27, 2021

Conversation

shanemcd
Copy link
Member

Before you would see unhelpful error messages like:

Traceback (most recent call last):
  File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 1397, in run
    res = receptor_job.run()
  File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 2957, in run
    return self._run_internal(receptor_ctl)
  File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 3008, in _run_internal
    raise RuntimeError(detail)
RuntimeError: exit status 0

Now you will see the underlying error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/ansible_runner/streaming.py", line 108, in run
    utils.unstream_dir(zip_data, self.private_data_dir)
  File "/usr/local/lib/python3.8/site-packages/ansible_runner/utils.py", line 104, in unstream_dir
    data = base64.b85decode(data)
  File "/usr/lib64/python3.8/base64.py", line 463, in b85decode
    raise ValueError('bad base85 character at position %d'
ValueError: bad base85 character at position 121

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@@ -1279,6 +1279,8 @@ def status_handler(self, status_data, runner_config):
if k in job_env:
job_env[k] = v
self.instance = self.update_model(self.instance.pk, job_args=json.dumps(runner_config.command), job_cwd=runner_config.cwd, job_env=job_env)
elif status_data['status'] == 'error':
self.instance = self.update_model(self.instance.pk, result_traceback=status_data['result_traceback'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but will the "result_traceback" key always be present??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough question. I'll add some guardrails.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 881ea12 into ansible:devel Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants