diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2018-05-27 20:10:54 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-06-20 18:01:21 +0100 |
commit | e5e372c749048387e2ed2c526c056c4e8533defa (patch) | |
tree | 48c703a355f581ba4363fc741b3147d3038a1575 | |
parent | 622f19f1a9d6efb633f665fc190ebf22da029582 (diff) | |
download | sos-e5e372c749048387e2ed2c526c056c4e8533defa.tar.gz |
[sosreport] make unknown --preset an error and display help
If an unknown preset is given on the command line, display an
error message and set self.opts.list_presets=True to show the
list of available presets.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/sosreport.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py index 4d2fff86..16f0dc82 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -354,11 +354,18 @@ class SoSReport(object): self._is_root = self.policy.is_root() - # Apply per-preset command line defaults + # user specified command line preset if cmd_args.preset != _arg_defaults["preset"]: self.preset = self.policy.find_preset(cmd_args.preset) - else: + if not self.preset: + sys.stderr.write("Unknown preset: '%s'\n" % cmd_args.preset) + self.preset = self.policy.probe_preset() + self.opts.list_presets = True + + # --preset=auto + if not self.preset: self.preset = self.policy.probe_preset() + self.opts.merge(self.preset.opts) # system temporary directory to use |