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