Skip to content

Drop Notice logs when rendering as json? #124

@waipeng

Description

@waipeng

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.34.0
  • Ruby: 2.7.8
  • Distribution: Ubuntu 22.04.5 LTS
  • Module version: 4.1.0

How to reproduce (e.g Puppet code you use)

 puppet catalog diff --confdir /etc/puppetlabs/puppet --render-as json puppet:/enva puppet:/envb --node_list server1.example.com                                                                                                                                                                                                    
Notice: Add --debug for realtime output, add --render-as {json,yaml} for parsed output                                                                                                                                
Notice: Add --debug for realtime output, add --render-as {json,yaml} for parsed output                                                                                                                               
{"server1.example.com":{"old_version":"1733993846","new_version":"1733993829","old_environment":"enva","new_environment":"envb", ...}                 

(server hostname and environment names have been changed to protect the innocent)

What are you seeing

Notice: logs, before the json, which makes it hard to dump the output to a json parser

What behaviour did you expect instead

Just json

Output log

Any additional information you'd like to impart

I would like to have catalog diff as part of CI / CD workflow, taking the json output from this and parsing it and displaying the diffs to users. However, there is an annoying Notice debug log which makes it hard for such a workflow (It can be worked around, of course).

I am wondering if I am calling it wrongly, should I have redirected logs to somewhere else? Trying --logdest didn't work.

Alternatively, can such Notice be dropped in a --render-as (or even totally) so as not to pollute the output? I don't see this message as particularly useful, users who need info should be able to use puppet catalog diff --help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions