Bug 1597198
Summary: | no such option: -q | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Radek Bíba <rbiba> |
Component: | sos | Assignee: | Pavel Moravec <pmoravec> |
Status: | CLOSED ERRATA | QA Contact: | Miroslav Hradílek <mhradile> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 7.5 | CC: | agk, bmr, gavin, plambri, sbradley |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | sos-3.7-1.el7 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2019-08-06 13:15:20 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Radek Bíba
2018-07-02 08:47:07 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). 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. > 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.
> 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).
(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. 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. 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 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> Thanks! This didnt catch 3.6 release / missed RHEL7.6 but should occur in 7.7. devel_ack+ to 7.7 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 |