diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2015-02-01 13:40:18 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2015-02-06 11:52:41 +0000 |
commit | 75901ef7906690aadaabc8925ac9a2e8523ed1a3 (patch) | |
tree | 4e41b1c6d3956776f68c42758c0a9a5ea8daf445 | |
parent | 5cc06136d68536b806ce09ce61f800d9a7938790 (diff) | |
download | sos-75901ef7906690aadaabc8925ac9a2e8523ed1a3.tar.gz |
[general] Better handling --name and --ticket-number in interactive mode
Carry forward values from the CLI options into the interactive mode,
resolves #485
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | sos/policies/__init__.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index 34a2f6a2..4c42d024 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -402,17 +402,20 @@ class LinuxPolicy(Policy): def pre_work(self): # this method will be called before the gathering begins - localname = self.get_local_name() + cmdline_opts = self.commons['cmdlineopts'] + customer_name = cmdline_opts.customer_name + localname = customer_name if customer_name else self.get_local_name() + caseid = cmdline_opts.case_id if cmdline_opts.case_id else "" - if not self.commons['cmdlineopts'].batch and not \ - self.commons['cmdlineopts'].quiet: + if not cmdline_opts.batch and not \ + cmdline_opts.quiet: try: self.report_name = input(_("Please enter your first initial " "and last name [%s]: ") % localname) self.case_id = input(_("Please enter the case id " "that you are generating this " - "report for: ")) + "report for [%s]: ") % caseid) self._print() except: self._print() @@ -421,11 +424,11 @@ class LinuxPolicy(Policy): if len(self.report_name) == 0: self.report_name = localname - if self.commons['cmdlineopts'].customer_name: - self.report_name = self.commons['cmdlineopts'].customer_name + if customer_name: + self.report_name = customer_name - if self.commons['cmdlineopts'].case_id: - self.case_id = self.commons['cmdlineopts'].case_id + if cmdline_opts.case_id: + self.case_id = cmdline_opts.case_id self.report_name = self.sanitize_report_name(self.report_name) if self.case_id: |