commit 26bd7ddd523af051916954723f3edb2ab6bd297e Author: Bryn M. Reeves Date: Fri Jan 24 15:13:22 2014 +0000 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 Conflicts: sos/policies/__init__.py diff --git a/man/en/sos.conf.5 b/man/en/sos.conf.5 index dc10b1b..b40a48e 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 87a099e..c800576 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 b681e77..47ace5c 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -280,79 +280,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, 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 1c81af9..fb3aea7 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -202,7 +202,6 @@ class SoSOptions(object): _onlyplugins = [] _plugopts = [] _usealloptions = False - _upload = False _batch = False _build = False _verbosity = 0 @@ -302,19 +301,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 @@ -484,9 +470,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") @@ -1130,12 +1113,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