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

[RFE] Make the output of "rpminspect -D" a valid YAML #306

Closed
msrb opened this issue Feb 25, 2021 · 2 comments
Closed

[RFE] Make the output of "rpminspect -D" a valid YAML #306

msrb opened this issue Feb 25, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request v1.4

Comments

@msrb
Copy link
Contributor

msrb commented Feb 25, 2021

Currently when I run rpminspect -D it prints the current configuration, but it also adds a header and footer (that one is maybe not intentional):

$ rpminspect -D -c /usr/share/rpminspect/redhat.yaml
Program Configuration
==========
    ---
    common:
        workdir: /var/tmp/rpminspect

<snip>

==========
rpminspect: *** Invalid before and after build specification.
rpminspect: *** See `rpminspect --help` for more information.

Everything's printed on stderr. This is OK for humans, but not for machines where I'd expect a valid YAML that I can parse.

I think the structure could stay the same, but the actual configuration could go to stdout instead of stderr. That way people could get the YAML and easily filter out the rest.

@msrb
Copy link
Contributor Author

msrb commented Feb 25, 2021

Note it also currently exits with 2. But when I use -D, I usually don't want to run rpminspect on any builds. I am just interested in the config :)

@dcantrell dcantrell self-assigned this Mar 3, 2021
@dcantrell dcantrell added enhancement New feature or request v1.4 labels Mar 3, 2021
@dcantrell
Copy link
Collaborator

This is reasonable. The original intent of the dump config function was to report what the actual configuration settings are for that invocation of the program. I will move it to stdout and make it parseable YAML and make sure it does error out.

dcantrell added a commit that referenced this issue Mar 3, 2021
Modify the dump_cfg() function to just write YAML to stdout.  Remove
the leading header and replace it with a comment.  Remove the 4
character indent on every line as well.

Also modify the handling of the -D option.  If you specify -D with no
build identifiers, rpminspect will dump the configuration and exit 0.
This also works if you want to pass it a configuration file to use but
just want to see what the final runtime configuration looks like.

You can use "rpminspect -D > config.yaml" to campture the runtime
configuration to a file.

Signed-off-by: David Cantrell <dcantrell@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v1.4
Projects
None yet
Development

No branches or pull requests

2 participants