RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1597198 - no such option: -q
Summary: no such option: -q
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sos
Version: 7.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Pavel Moravec
QA Contact: Miroslav Hradílek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-02 08:47 UTC by Radek Bíba
Modified: 2019-08-06 13:15 UTC (History)
5 users (show)

Fixed In Version: sos-3.7-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-06 13:15:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2019:2295 0 None None None 2019-08-06 13:15:44 UTC

Description Radek Bíba 2018-07-02 08:47:07 UTC
Description of problem:
`man sosreport' says:

       -q, --quiet
              Only log fatal errors to stderr.

However, -q doesn't seem to be supported:

# sosreport --batch -q
Usage: sosreport [options]

sosreport: error: no such option: -q

Unlike --quiet:

# sosreport --batch --quiet
# 

Version-Release number of selected component (if applicable):
sos-3.5-9.el7_5

How reproducible:
Always

Steps to Reproduce:
1. see above

Actual results:
see above

Expected results:
Either -q is also accepted or the man page doesn't advertise this switch.

Additional info:
On a related note, I'd appreciate a semi-quiet mode in which sosreport would only print the path to the created archive so that a script calling sosreport could get just that piece of information and do something with the archive. What I can do now is:

archive=$(sosreport --batch | grep -A1 '^Your sosreport has been generated and saved in:' | tail -1)

but I don't like that very much.

Comment 2 Pavel Moravec 2018-07-02 11:13:26 UTC
Too late for 7.6 that is beyond devel phase.

ACK the bug itself - adding/having "-q" makes sense. Also the request "print just directory/tarball" is a valid one but it would require a new option (easy to add, though).

Comment 3 Bryn M. Reeves 2018-07-02 11:15:34 UTC
Technically a documentation bug: the short option has never existed.

There's no reason why we can't add the alias though. It's a trivial change.

Comment 4 Bryn M. Reeves 2018-07-02 11:18:09 UTC
> archive=$(sosreport --batch | grep -A1 '^Your sosreport has been generated and saved in:' | tail -1)

Eh, why not just try the long option? ;)

Even so, the description of the option is accurate: only print *fatal errors*. It will not yield the path to the archive file. Again, something that we could probably add easily enough but it's not how --quiet behaves today: it silences all non-error messages.

Comment 5 Bryn M. Reeves 2018-07-02 11:19:26 UTC
> it would require a new option

Not sure it's worth it. We could just print the final location (rather than use the log facility) to either stdout or stderr - I'm not entirely certain which is better right now (historically --quiet silenced stdout, but it's not really correct to output a status message on stderr).

Comment 6 Radek Bíba 2018-07-02 11:33:30 UTC
(In reply to Bryn M. Reeves from comment #4)
> > archive=$(sosreport --batch | grep -A1 '^Your sosreport has been generated and saved in:' | tail -1)
> 
> Eh, why not just try the long option? ;)

Which long option? --quiet? That one makes sosreport completely quiet (at present).

I'd be fine with -q/--quiet decreasing the verbosity all the way down to the location of the tarball or a new option to do so. I don't have a strong preference either way.

Comment 7 Bryn M. Reeves 2018-07-02 11:49:09 UTC
Yes: that's what I just tried to explain in the paragraph below. The -q alias is a documentation bug, but the --quiet option behaves exactly as described in the text you quoted in comment #0 and has done since it was added: it entirely disables all output other than error messages.

Comment 8 Bryn M. Reeves 2018-07-02 12:12:05 UTC
Patch to let archive messages bypass --quiet:

diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index 45eecfe1..7b301dec 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -519,10 +519,10 @@ No changes will be made to system configuration.
 
         if archive:
             self._print(_("Your sosreport has been generated and saved "
-                        "in:\n  %s") % archive)
+                        "in:\n  %s") % archive, always=True)
         else:
             self._print(_("sosreport build tree is located at : %s" %
-                        directory))
+                        directory), always=True)
 
         self._print()
         if checksum:
@@ -532,10 +532,10 @@ No changes will be made to system configuration.
                         "representative."))
         self._print()
 
-    def _print(self, msg=None):
+    def _print(self, msg=None, always=False):
         """A wrapper around print that only prints if we are not running in
         quiet mode"""
-        if not self.commons['cmdlineopts'].quiet:
+        if always or not self.commons['cmdlineopts'].quiet:
             if msg:
                 print_(msg)
             else:

# ./sosreport -vvv --debug --batch --quiet -o host
Your sosreport has been generated and saved in:
  /var/tmp/sosreport-localhost-2018-07-02-brqmrge.tar.xz

# ./sosreport -vvv --debug --batch --quiet --build -o host
sosreport build tree is located at : /var/tmp/sosreport-localhost-2018-07-02-ysfvxaq

Comment 9 Bryn M. Reeves 2018-07-02 12:14:02 UTC
commit 0a76861b9690889b59a95161af473e62c962c787
Author: Bryn M. Reeves <bmr>
Date:   Mon Jul 2 13:13:15 2018 +0100

    [sosreport] accept -q as alias for --quiet
    
    Signed-off-by: Bryn M. Reeves <bmr>

commit a7ccf68366cc5481570f821e8cfd4bd84b7e7c8d
Author: Bryn M. Reeves <bmr>
Date:   Mon Jul 2 13:12:13 2018 +0100

    [Policy] allow final archive messages to bypass --quiet
    
    Always output the tarball or build tree location, regardless of
    the value of -q/--quiet.
    
    Signed-off-by: Bryn M. Reeves <bmr>

Comment 10 Radek Bíba 2018-07-02 13:16:59 UTC
Thanks!

Comment 11 Pavel Moravec 2018-11-06 09:24:11 UTC
This didnt catch 3.6 release / missed RHEL7.6 but should occur in 7.7.

devel_ack+ to 7.7

Comment 15 errata-xmlrpc 2019-08-06 13:15:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2019:2295


Note You need to log in before you can comment on or make changes to this bug.