1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[opentelemetry][callback] fix hardcoded value for ansible_task_message (#4624)

* [opentelemetry][callback] fix hardcoded value for ansible_task_message

* opentelemetry: add changelog fragment
This commit is contained in:
Victor Martinez 2022-05-05 11:42:59 +01:00 committed by GitHub
parent 532a26692c
commit 9f702946cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- opentelemetry callback plugin - fix task message attribute that is reported failed regardless of the task result (https://github.com/ansible-collections/community.general/pull/4624).

View file

@ -258,8 +258,9 @@ class OpenTelemetrySource(object):
else: else:
res = host_data.result._result res = host_data.result._result
rc = res.get('rc', 0) rc = res.get('rc', 0)
message = self.get_error_message(res) if host_data.status == 'failed':
enriched_error_message = self.enrich_error_message(res) message = self.get_error_message(res)
enriched_error_message = self.enrich_error_message(res)
if host_data.status == 'failed': if host_data.status == 'failed':
status = Status(status_code=StatusCode.ERROR, description=message) status = Status(status_code=StatusCode.ERROR, description=message)