AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
However, when attempting to convert it to yaml using ruamel.yaml and the 'rt' or 'safe' dumper, this results in an error:
vars = client.hosts.get(name=hostname).results[0].get_related('variable_data')
yaml.dump(vars, sys.stdout)
raise RepresenterError(f'cannot represent an object: {data!s}')
ruamel.yaml.representer.RepresenterError: cannot represent an object: {
The 'unsafe' dumper will dump the objects but that data is not useful as yaml output.
Select the relevant components
[ ] UI
[X] API
[ ] Docs
[ ] Collection
[ ] CLI
[ ] Other
Steps to reproduce
vars = client.hosts.get(name=hostname).results[0].get_related('variable_data')
yaml.dump(vars, sys.stdout)
Current results
ruamel.yaml.representer.RepresenterError: cannot represent an object: {
Sugested feature result
It would be nice if there was a way to indicate that yaml output was desired or a utility function that could convert the objects back to regular python data structures.
Please confirm the following
Feature type
New Feature
Feature Summary
When retrieving data like the following:
The resulting data is return as a json structure:
However, when attempting to convert it to yaml using ruamel.yaml and the 'rt' or 'safe' dumper, this results in an error:
The 'unsafe' dumper will dump the objects but that data is not useful as yaml output.
Select the relevant components
Steps to reproduce
Current results
Sugested feature result
It would be nice if there was a way to indicate that yaml output was desired or a utility function that could convert the objects back to regular python data structures.
Additional information
No response