Blame SOURCES/sos-bz1185093-sos-ticket-number-name-params.patch

c81b6a
From 75901ef7906690aadaabc8925ac9a2e8523ed1a3 Mon Sep 17 00:00:00 2001
c81b6a
From: Pavel Moravec <pmoravec@redhat.com>
c81b6a
Date: Sun, 1 Feb 2015 13:40:18 +0100
c81b6a
Subject: [PATCH] [general] Better handling --name and --ticket-number in
c81b6a
 interactive mode
c81b6a
c81b6a
Carry forward values from the CLI options into the interactive mode,
c81b6a
resolves #485
c81b6a
c81b6a
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
c81b6a
---
c81b6a
 sos/policies/__init__.py | 19 +++++++++++--------
c81b6a
 1 file changed, 11 insertions(+), 8 deletions(-)
c81b6a
c81b6a
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
c81b6a
index 34a2f6a..4c42d02 100644
c81b6a
--- a/sos/policies/__init__.py
c81b6a
+++ b/sos/policies/__init__.py
c81b6a
@@ -402,17 +402,20 @@ class LinuxPolicy(Policy):
c81b6a
     def pre_work(self):
c81b6a
         # this method will be called before the gathering begins
c81b6a
 
c81b6a
-        localname = self.get_local_name()
c81b6a
+        cmdline_opts = self.commons['cmdlineopts']
c81b6a
+        customer_name = cmdline_opts.customer_name
c81b6a
+        localname = customer_name if customer_name else self.get_local_name()
c81b6a
+        caseid = cmdline_opts.case_id if cmdline_opts.case_id else ""
c81b6a
 
c81b6a
-        if not self.commons['cmdlineopts'].batch and not \
c81b6a
-                self.commons['cmdlineopts'].quiet:
c81b6a
+        if not cmdline_opts.batch and not \
c81b6a
+                cmdline_opts.quiet:
c81b6a
             try:
c81b6a
                 self.report_name = input(_("Please enter your first initial "
c81b6a
                                          "and last name [%s]: ") % localname)
c81b6a
 
c81b6a
                 self.case_id = input(_("Please enter the case id "
c81b6a
                                        "that you are generating this "
c81b6a
-                                       "report for: "))
c81b6a
+                                       "report for [%s]: ") % caseid)
c81b6a
                 self._print()
c81b6a
             except:
c81b6a
                 self._print()
c81b6a
@@ -421,11 +424,11 @@ class LinuxPolicy(Policy):
c81b6a
         if len(self.report_name) == 0:
c81b6a
             self.report_name = localname
c81b6a
 
c81b6a
-        if self.commons['cmdlineopts'].customer_name:
c81b6a
-            self.report_name = self.commons['cmdlineopts'].customer_name
c81b6a
+        if customer_name:
c81b6a
+            self.report_name = customer_name
c81b6a
 
c81b6a
-        if self.commons['cmdlineopts'].case_id:
c81b6a
-            self.case_id = self.commons['cmdlineopts'].case_id
c81b6a
+        if cmdline_opts.case_id:
c81b6a
+            self.case_id = cmdline_opts.case_id
c81b6a
 
c81b6a
         self.report_name = self.sanitize_report_name(self.report_name)
c81b6a
         if self.case_id:
c81b6a
-- 
c81b6a
1.8.3.1
c81b6a