diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2018-02-19 14:06:23 -0500 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-05-09 11:57:56 +0100 |
commit | 1167dab89e7097478b4744906045b0b9f3855d45 (patch) | |
tree | 81d3a5da757018b3f341691dbf80ee1b09d0748f | |
parent | cc6d132583b7286e2cc14805e49dbc99651ef603 (diff) | |
download | sos-1167dab89e7097478b4744906045b0b9f3855d45.tar.gz |
[alternatives] Add new plugin
Adds a new plugin to capture output for alternatives
Resolves: #1220
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/alternatives.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/sos/plugins/alternatives.py b/sos/plugins/alternatives.py new file mode 100644 index 00000000..7c3e5c64 --- /dev/null +++ b/sos/plugins/alternatives.py @@ -0,0 +1,52 @@ +# Copyright (C) 2018 Red Hat, Inc., Jake Hunsaker <jhunsake@redhat.com> + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +from sos.plugins import Plugin, RedHatPlugin +from sos.utilities import is_executable + + +class Alternatives(Plugin, RedHatPlugin): + """System alternatives + """ + + packages = ('chkconfig',) + commands = ('alternatives',) + + def setup(self): + self.add_cmd_output([ + 'alternatives --list', + 'alternatives --version' + ]) + + alts = [] + ignore = [ + 'cdrecord', + 'ld', + 'mkisofs', + 'whois', + 'xinputrc' + ] + + res = self.get_command_output('alternatives --list') + if res['status'] == 0: + for line in res['output'].splitlines(): + alt = line.split()[0] + if alt not in ignore: + alts.append(alt) + disp_cmd = "alternatives --display %s" + self.add_cmd_output([disp_cmd % alt for alt in alts]) + +# vim: set et ts=4 sw=4 : |