As user of the IPA command line tool , I want an option to output as JSON so that I can easily load and parse results from IPA calls.
The ipa CLI tool returns data in human readable form. While it's useful for humans, the output is not easy to parse by machines and automation. In the container world, it is common to have an option to return machine-parsable data. For example podman has a --format=json / -f json option. OpenShift's oc and Kubernetes' kubectl have an --output / -o that supports a wide ranges of formats including json, yaml, and jsonpath expressions.
ipa
--format=json
-f json
oc
kubectl
--output
-o
I propose to add an option to ipa that simply prints the raw JSON result from the IPA server to stdout. For errors, the option should print the raw error JSON to stdout and human readable error to stderr. My preferred option is -o json / --output=json as the -f option is already taken by --no-fallback. --json would also work. However -o has the benefit that it can be more easily extended to support other output formats like yaml later.
-o json
--output=json
-f
--no-fallback
--json
yaml
Metadata Update from @cheimes: - Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1513934
I am a bit concerned with -o as we have --out in several IPA CLI commands that allow to save certificates:
--out
$ git grep "'out'"|grep /plugins/|wc -l 26