aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2014-01-24 15:13:22 +0000
committerBryn M. Reeves <bmr@redhat.com>2014-01-24 15:13:22 +0000
commitd523cfb942d1a1f5467ff3151b6914c1b1598a8e (patch)
treee86222b2a46f01aadc6a286e5665367ce15f61ca
parent55b48fa4c5e625c74b1ffd80213b3cd72809365a (diff)
downloadsos-d523cfb942d1a1f5467ff3151b6914c1b1598a8e.tar.gz
Remove --upload option
The --upload option has a lot of limitations and has not been widely used. Recent trends are to handle uploading data in higher-level tools (e.g. redhat-support-tool or web based management UIs) and the python ftp library does not support modern requirements like HTTP proxy traversal or encryption. Fixes Issue #217 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--man/en/sos.conf.541
-rw-r--r--man/en/sosreport.15
-rw-r--r--sos/policies/__init__.py73
-rw-r--r--sos/sosreport.py24
4 files changed, 25 insertions, 118 deletions
diff --git a/man/en/sos.conf.5 b/man/en/sos.conf.5
index dc10b1be..b40a48e1 100644
--- a/man/en/sos.conf.5
+++ b/man/en/sos.conf.5
@@ -6,26 +6,31 @@ sos.conf \- sosreport configuration
sosreport uses a configuration file at /etc/sos.conf.
.SH PARAMETERS
.sp
-There are 3 sections of configuration in the sosreport configuration file: general,
-plugins, and tunables.
-.SH [general] OPTIONS
-.sp
-.in
-ftp_upload_url Default ftp server to send reports.
-.in
-gpg_keyring Default gpgkey.
-.in
-gpg_recipient GPG recipient
-.in
-smtp_server Mail server
-.SH [plugins] OPTIONS
-.sp
-.in
+There are two sections in the sosreport configuration file:
+plugins, and tunables. Options are set using 'ini'-style
+\fBname = value\fP pairs.
+
+Some options accept a comma separated list of values.
+
+.TP
+\fB[plugins]\fP
disable Comma separated list of plugins to disable.
-.SH [tunables] OPTIONS
+.TP
+\fB[tunables]\fP
+plugin.option Alter available options for defined plugin.
+.SH EXAMPLES
+To disable the 'general' and 'filesys' plugins:
+.LP
+[plugins]
+.br
+disable = general, filesys
.sp
-.in
-(plugin, option) Alter available options for defined plugin.
+To disable rpm package verification in the RPM plugin:
+.LP
+[tunables]
+.br
+rpm.rpmva = off
+.br
.SH FILES
.sp
/etc/sos.conf
diff --git a/man/en/sosreport.1 b/man/en/sosreport.1
index 87a099e6..c8005768 100644
--- a/man/en/sosreport.1
+++ b/man/en/sosreport.1
@@ -10,7 +10,7 @@ sosreport \- Collect and package diagnostic and support data
[-a|--alloptions] [-v|--verbose]\fR
[--report] [--config-file conf] [--batch]\fR
[--build] [--name name] [--ticket-number number]
- [--debug] [--upload] [--tmp-dir directory]\fR
+ [--debug] [--tmp-dir directory]\fR
[--profile] [--help]\fR
.SH DESCRIPTION
\fBsosreport\fR generates a compressed tar archive of diagnostic
@@ -50,9 +50,6 @@ specified value in the plug-in PLUGNAME.
.B \-a, \--alloptions
Set all boolean options to True for all enabled plug-ins.
.TP
-.B \--upload FTP_SERVER
-Upload the report to the configured destination.
-.TP
.B \-v, \--verbose
Increase logging verbosity. May be specified multiple times to enable
additional debugging messages.
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index d4bec69e..120d13cb 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -282,79 +282,6 @@ No changes will be made to system configuration.
self._print(_("Please send this file to your support representative."))
self._print()
- def upload_results(self, final_filename):
-
- # make sure a report exists
- if not final_filename:
- return False
-
- self._print()
- # make sure it's readable
- try:
- fp = open(final_filename, "r")
- except:
- return False
-
- # read ftp URL from configuration
- if self.commons['cmdlineopts'].upload:
- upload_url = self.commons['cmdlineopts'].upload
- else:
- try:
- upload_url = self.commons['config'].get("general", "ftp_upload_url")
- except:
- self._print(_("No URL defined in config file."))
- return
-
- from urlparse import urlparse
- url = urlparse(upload_url)
-
- if url[0] != "ftp":
- self._print(_("Cannot upload to specified URL."))
- return
-
- # extract username and password from URL, if present
- if url[1].find("@") > 0:
- username, host = url[1].split("@", 1)
- if username.find(":") > 0:
- username, passwd = username.split(":", 1)
- else:
- passwd = None
- else:
- username, passwd, host = None, None, url[1]
-
- # extract port, if present
- if host.find(":") > 0:
- host, port = host.split(":", 1)
- port = int(port)
- else:
- port = 21
-
- path = url[2]
-
- try:
- from ftplib import FTP
- upload_name = os.path.basename(final_filename)
-
- ftp = FTP()
- ftp.connect(host, port)
- if username and passwd:
- ftp.login(username, passwd)
- else:
- ftp.login()
- ftp.cwd(path)
- ftp.set_pasv(True)
- ftp.storbinary('STOR %s' % upload_name, fp)
- ftp.quit()
- except Exception as e:
- self._print(_("There was a problem uploading your report to Red Hat support. " + str(e)))
- else:
- self._print(_("Your report was successfully uploaded to %s with name:" % (upload_url,)))
- self._print(" " + upload_name)
- self._print()
- self._print(_("Please communicate this name to your support representative."))
- self._print()
-
- fp.close()
def _print(self, msg=None):
"""A wrapper around print that only prints if we are not running in
diff --git a/sos/sosreport.py b/sos/sosreport.py
index 32bcabff..4b525727 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -210,7 +210,6 @@ class SoSOptions(object):
_onlyplugins = []
_plugopts = []
_usealloptions = False
- _upload = False
_batch = False
_build = False
_verbosity = 0
@@ -310,19 +309,6 @@ class SoSOptions(object):
self._usealloptions = value
@property
- def upload(self):
- if self._options != None:
- return self._options.upload
- return self._upload
-
- @upload.setter
- def upload(self, value):
- self._check_options_initialized()
- if not isinstance(value, bool):
- raise TypeError("SoSOptions.upload expects a boolean")
- self._upload = value
-
- @property
def batch(self):
if self._options != None:
return self._options.batch
@@ -492,9 +478,6 @@ class SoSOptions(object):
parser.add_option("-a", "--alloptions", action="store_true",
dest="usealloptions", default=False,
help="enable all options for loaded plugins")
- parser.add_option("-u", "--upload", action="store",
- dest="upload", default=False,
- help="upload the report to an ftp server")
parser.add_option("--batch", action="store_true",
dest="batch", default=False,
help="batch mode - do not prompt interactively")
@@ -1138,12 +1121,7 @@ class SoSReport(object):
else:
final_filename = self.archive.get_archive_path()
- # automated submission will go here
- if not self.opts.upload:
- self.policy.display_results(final_filename, build = self.opts.build)
- else:
- self.policy.upload_results(final_filename)
-
+ self.policy.display_results(final_filename, build = self.opts.build)
self.tempfile_util.clean()
return True