aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>2014-09-15 18:18:57 +0530
committerBryn M. Reeves <bmr@redhat.com>2014-09-16 10:34:18 +0100
commitf627328a6594de60402589c21fb7aefabef9ab3a (patch)
tree099352356cb1fe1f28760da0e14d95c1a159c54e
parentf53b9c15d5b63d1e07fbb232984945619bbbe991 (diff)
downloadsos-f627328a6594de60402589c21fb7aefabef9ab3a.tar.gz
sosreport: Accept commas, period and alphas in the case id
sosreport does not accept commas, period and alphas in the case id, the patch fixes the same. Change the ticket number field to case id as it now accepts alpha numerals as well but maintain the '--ticket-number' option for compatibility. Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--man/en/sosreport.16
-rw-r--r--sos/policies/__init__.py25
-rw-r--r--sos/sosreport.py19
3 files changed, 26 insertions, 24 deletions
diff --git a/man/en/sosreport.1 b/man/en/sosreport.1
index 8471dfb7..3714da06 100644
--- a/man/en/sosreport.1
+++ b/man/en/sosreport.1
@@ -9,7 +9,7 @@ sosreport \- Collect and package diagnostic and support data
[-o|--only-plugins plugin-names]\fR
[-a|--alloptions] [-v|--verbose]\fR
[--report] [--config-file conf] [--batch]\fR
- [--build] [--name name] [--ticket-number number]
+ [--build] [--name name] [--case-id id]
[--debug] [--tmp-dir directory]\fR
[-z|--compression-type method]\fR
[--help]\fR
@@ -78,8 +78,8 @@ Generate archive without prompting for interactive input.
.B \--name NAME
Specify a name to be used for the archive.
.TP
-.B \--ticket-number NUMBER
-Specify a ticket number to be used for archive
+.B \--case-id NUMBER
+Specify a case id to be used for archive
.TP
.B \--build
Do not archive copied data. Causes sosreport to leave an uncompressed
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index 89bc6760..9fcbd552 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -152,7 +152,7 @@ No changes will be made to system configuration.
modifying PATH in their own initializer."""
self._parse_uname()
self.report_name = self.hostname
- self.ticket_number = None
+ self.case_id = None
self.package_manager = PackageManager()
self._valid_subclasses = []
self.set_exec_path()
@@ -198,8 +198,8 @@ No changes will be made to system configuration.
This function should return the filename of the archive without the
extension.
"""
- if self.ticket_number:
- self.report_name += "." + self.ticket_number
+ if self.case_id:
+ self.report_name += "." + self.case_id
return "sosreport-%s-%s" % (self.report_name,
time.strftime("%Y%m%d%H%M%S"))
@@ -395,8 +395,8 @@ class LinuxPolicy(Policy):
def sanitize_report_name(self, report_name):
return re.sub(r"[^-a-zA-Z.0-9]", "", report_name)
- def sanitize_ticket_number(self, ticket_number):
- return re.sub(r"[^0-9]", "", ticket_number)
+ def sanitize_case_id(self, case_id):
+ return re.sub(r"[^-a-z,A-Z.0-9]", "", case_id)
def pre_work(self):
# this method will be called before the gathering begins
@@ -409,9 +409,9 @@ class LinuxPolicy(Policy):
self.report_name = input(_("Please enter your first initial "
"and last name [%s]: ") % localname)
- self.ticket_number = input(_("Please enter the case number "
- "that you are generating this "
- "report for: "))
+ self.case_id = input(_("Please enter the case id "
+ "that you are generating this "
+ "report for: "))
self._print()
except:
self._print()
@@ -423,13 +423,12 @@ class LinuxPolicy(Policy):
if self.commons['cmdlineopts'].customer_name:
self.report_name = self.commons['cmdlineopts'].customer_name
- if self.commons['cmdlineopts'].ticket_number:
- self.ticket_number = self.commons['cmdlineopts'].ticket_number
+ if self.commons['cmdlineopts'].case_id:
+ self.case_id = self.commons['cmdlineopts'].case_id
self.report_name = self.sanitize_report_name(self.report_name)
- if self.ticket_number:
- self.ticket_number = self.sanitize_ticket_number(
- self.ticket_number)
+ if self.case_id:
+ self.case_id = self.sanitize_case_id(self.case_id)
if (self.report_name == ""):
self.report_name = "default"
diff --git a/sos/sosreport.py b/sos/sosreport.py
index 95da0372..bf9adafe 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -217,7 +217,7 @@ class SoSOptions(object):
_verify = False
_quiet = False
_debug = False
- _ticket_number = ""
+ _case_id = ""
_customer_name = ""
_config_file = ""
_tmp_dir = ""
@@ -415,15 +415,15 @@ class SoSOptions(object):
self._debug = value
@property
- def ticket_number(self):
+ def case_id(self):
if self._options is not None:
- return self._options.ticket_number
- return self._ticket_number
+ return self._options.case_id
+ return self._case_id
- @ticket_number.setter
- def ticket_number(self, value):
+ @case_id.setter
+ def case_id(self, value):
self._check_options_initialized()
- self._ticket_number = value
+ self._case_id = value
@property
def customer_name(self):
@@ -533,8 +533,11 @@ class SoSOptions(object):
help="enable interactive debugging using the python "
"debugger")
parser.add_option("--ticket-number", action="store",
- dest="ticket_number",
+ dest="case_id",
help="specify ticket number")
+ parser.add_option("--case-id", action="store",
+ dest="case_id",
+ help="specify case identifier")
parser.add_option("--name", action="store",
dest="customer_name",
help="specify report name")