aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/en/sos.conf.541
-rw-r--r--man/en/sosreport.15
-rw-r--r--sos/archive.py4
-rw-r--r--sos/plugins/anacron.py3
-rw-r--r--sos/plugins/named.py1
-rw-r--r--sos/plugins/yum.py2
-rw-r--r--sos/policies/__init__.py95
-rw-r--r--sos/policies/redhat.py20
-rw-r--r--sos/sosreport.py24
-rw-r--r--sos/utilities.py2
-rw-r--r--tests/utilities_tests.py4
11 files changed, 45 insertions, 156 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/archive.py b/sos/archive.py
index 4c8cceb1..f1d4d1fb 100644
--- a/sos/archive.py
+++ b/sos/archive.py
@@ -255,9 +255,9 @@ class TarFileArchive(FileCacheArchive):
p = Popen(command, stdout=PIPE, stderr=PIPE, bufsize=-1)
stdout, stderr = p.communicate()
if stdout:
- log.info(stdout)
+ log.info(stdout.decode('utf-8'))
if stderr:
- log.error(stderr)
+ log.error(stderr.decode('utf-8'))
self._suffix += suffix
return self.name()
except Exception as e:
diff --git a/sos/plugins/anacron.py b/sos/plugins/anacron.py
index 04b0dcbf..a60c85e1 100644
--- a/sos/plugins/anacron.py
+++ b/sos/plugins/anacron.py
@@ -17,7 +17,8 @@ from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class Anacron(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
-
+ """ capture scheduled jobs information """
+
plugin_name = 'anacron'
packages = ('anacron',)
diff --git a/sos/plugins/named.py b/sos/plugins/named.py
index 83567ab2..e73bf42a 100644
--- a/sos/plugins/named.py
+++ b/sos/plugins/named.py
@@ -14,7 +14,6 @@
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from os.path import exists, join, normpath
-import commands
import pdb
class Named(Plugin):
diff --git a/sos/plugins/yum.py b/sos/plugins/yum.py
index 5abf06f6..867302c5 100644
--- a/sos/plugins/yum.py
+++ b/sos/plugins/yum.py
@@ -26,8 +26,6 @@ class Yum(Plugin, RedHatPlugin):
("yumdebug", "gather yum debugging data", "slow", False)]
def setup(self):
- rhelver = self.policy().rhel_version()
-
# Pull all yum related information
self.add_copy_specs([
"/etc/yum",
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index d4bec69e..c272e5c6 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -117,17 +117,21 @@ class PackageManager(object):
class Policy(object):
msg = _("""\
-This command will collect system configuration and diagnostic information \
-from this %(distro)s system. An archive containing the collected information \
-will be generated in %(tmpdir)s.
+This command will collect diagnostic and configuration \
+information from this %(distro)s system and installed \
+applications.
-For more information on %(vendor)s visit:
+An archive containing the collected information will be \
+generated in %(tmpdir)s and may be provided to a %(vendor)s \
+support representative.
+Any information provided to %(vendor)s will be treated in \
+accordance with the published support policies at:\n
%(vendor_url)s
-The generated archive may contain data considered sensitive and its content \
-should be reviewed by the originating organization before being passed to \
-any third party.
+The generated archive may contain data considered sensitive \
+and its content should be reviewed by the originating \
+organization before being passed to any third party.
No changes will be made to system configuration.
%(vendor_text)s
@@ -282,79 +286,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
@@ -371,14 +302,14 @@ No changes will be made to system configuration.
the user in non-batch mode. If your policy sets self.distro that
text will be substituted accordingly. You can also override this
method to do something more complicated."""
- width = 58
+ width = 72
_msg = self.msg % {'distro': self.distro, 'vendor': self.vendor,
'vendor_url': self.vendor_url,
'vendor_text': self.vendor_text,
'tmpdir': self.commons['tmpdir']}
_fmt = ""
for line in _msg.splitlines():
- _fmt = _fmt + fill(" " + line, width, replace_whitespace = False) + '\n'
+ _fmt = _fmt + fill(line, width, replace_whitespace = False) + '\n'
return _fmt
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
index 93218157..5b3a4468 100644
--- a/sos/policies/redhat.py
+++ b/sos/policies/redhat.py
@@ -91,26 +91,6 @@ class RedHatPolicy(LinuxPolicy):
return self.host_name()
class RHELPolicy(RedHatPolicy):
-
- msg = _("""\
-This command will collect system configuration and diagnostic information \
-from this %(distro)s system. An archive containing the collected information \
-will be generated in %(tmpdir)s and may be provided to a %(vendor)s support \
-representative or used for local diagnostic or recording purposes.
-
-Any information provided to %(vendor)s will be treated in strict confidence \
-in accordance with the published support policies at:
-
- %(vendor_url)s
-
-The generated archive may contain data considered sensitive and its content \
-should be reviewed by the originating organization before being passed to \
-any third party.
-
-No changes will be made to system configuration.
-%(vendor_text)s
-""")
-
distro = "Red Hat Enterprise Linux"
vendor = "Red Hat"
vendor_url = "https://access.redhat.com/support/"
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
diff --git a/sos/utilities.py b/sos/utilities.py
index da455a15..7a8674ad 100644
--- a/sos/utilities.py
+++ b/sos/utilities.py
@@ -161,7 +161,7 @@ def sos_get_command_output(command, timeout=300):
stdout=PIPE, stderr=STDOUT,
bufsize=-1, env = cmd_env)
stdout, stderr = p.communicate()
- return (p.returncode, stdout, 0)
+ return (p.returncode, stdout.decode('utf-8'), 0)
else:
return (127, "", 0)
diff --git a/tests/utilities_tests.py b/tests/utilities_tests.py
index 3ecf8c2b..04c52412 100644
--- a/tests/utilities_tests.py
+++ b/tests/utilities_tests.py
@@ -81,7 +81,7 @@ class ExecutableTest(unittest.TestCase):
path = os.path.join(TEST_DIR, 'test_exe.py')
ret, out, junk = sos_get_command_output(path)
self.assertEquals(ret, 0)
- self.assertEquals(out, six.b("executed\n"))
+ self.assertEquals(out, "executed\n")
def test_output_non_exe(self):
path = os.path.join(TEST_DIR, 'utility_tests.py')
@@ -91,7 +91,7 @@ class ExecutableTest(unittest.TestCase):
def test_shell_out(self):
path = os.path.join(TEST_DIR, 'test_exe.py')
- self.assertEquals(six.b("executed\n"), shell_out(path))
+ self.assertEquals("executed\n", shell_out(path))
class FindTest(unittest.TestCase):