ansible-runner icon indicating copy to clipboard operation
ansible-runner copied to clipboard

Add hostvars mapping in awx_display callback

Open Akasurde opened this issue 2 years ago • 4 comments

SUMMARY

Fixes: #1137

Signed-off-by: Abhijeet Kasurde [email protected]

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

ansible_runner/display_callback/callback/awx_display.py

Akasurde avatar Jan 17 '23 10:01 Akasurde

cc @sivel

Akasurde avatar Jan 17 '23 10:01 Akasurde

We should add some regression test coverage, but :+1: this looks good.

AlanCoding avatar Jan 17 '23 13:01 AlanCoding

The encoder class is pretty self-aware that it duplicates the Ansible-core version, in its doc string:

The class AnsibleJSONEncoder exists in Ansible core for this function this performs a mostly identical function via duck typing

We should really fix this soon, so I want to formalize the suggestion. Is the idea to replace the AnsibleJSONEncoderLocal class inside of ansible_runner.display_callback.callback.awx_display with instead an import to this?

from ansible.module_utils.common.json import AnsibleJSONEncoder

AlanCoding avatar Apr 10 '23 19:04 AlanCoding

Yeah, probably something along those lines, at least for this specific case, but especially once data tagging lands, we'll need to be much more specific about what metadata we actually want to preserve in the callback output.

I'm still uncertain about the value of e.g., preserving the internal representation of an inline vaulted var in callback output. Shouldn't we just mask the value? I don't know what people typically do with the serialized output details like this beyond just looking at it in the UI, and we're only providing special handling for an uncommon subset of vault stuff today... Data tagging will provide us with a whole lot more choices to make about this, but also a lot more flexibility.

nitzmahone avatar Apr 10 '23 20:04 nitzmahone