Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.
from sos.plugins import Plugin, RedHatPlugin
import os
import stat
class Unpackaged(Plugin, RedHatPlugin):
'''
Collects a list of files that are not handled by the package
manager
'''
def setup(self):
def get_env_path_list():
"""Return a list of directories in $PATH.
"""
return os.environ['PATH'].split(':')
def all_files_system(path, exclude=None):
"""Retrun a list of all files present on the system, excluding
any directories listed in `exclude`.
class KDump(Plugin):
"""Kdump crash dumps
"""
plugin_name = "kdump"
profiles = ('system', 'debug')
def setup(self):
self.add_copy_spec([
"/proc/cmdline",
"/sys/kernel/kexec_crash_loaded",
"/sys/kernel/kexec_crash_size"
])
class RedHatKDump(KDump, RedHatPlugin):
files = ('/etc/kdump.conf',)
packages = ('kexec-tools',)
def fstab_parse_fs(self, device):
with open('/etc/fstab', 'r') as fp:
for line in fp:
if line.startswith((device)):
return line.split()[1].rstrip('/')
return ""
def read_kdump_conffile(self):
fs = ""
path = "/var/crash"
with open('/etc/kdump.conf', 'r') as fp:
# Copyright (C) 2015 Red Hat, Inc., Abhijeet Kasurde
# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.
from sos.plugins import Plugin, RedHatPlugin
class Redis(Plugin, RedHatPlugin):
"""Redis, in-memory data structure store
"""
plugin_name = 'redis'
profiles = ('services',)
packages = ('redis',)
var_puppet_gen = "/var/lib/config-data/puppet-generated/redis"
files = (
'/etc/redis.conf',
'/var/log/redis',
var_puppet_gen + '/etc/redis.conf'
)
def setup(self):
self.add_copy_spec([
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.
from sos.plugins import Plugin, RedHatPlugin
class OpenDaylight(Plugin, RedHatPlugin):
"""OpenDaylight network manager
"""
plugin_name = 'opendaylight'
profiles = ('openstack', 'openstack_controller')
packages = ('opendaylight', 'puppet-opendaylight')
var_puppet_gen = "/var/lib/config-data/puppet-generated/opendaylight"
def setup(self):
self.add_copy_spec([
"/opt/opendaylight/etc/",
self.var_puppet_gen + "/opt/opendaylight/etc/",
])
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
from re import match
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
class HAProxy(Plugin, RedHatPlugin, DebianPlugin):
"""HAProxy load balancer
"""
plugin_name = 'haproxy'
profiles = ('webserver',)
packages = ('haproxy',)
def setup(self):
var_puppet_gen = "/var/lib/config-data/puppet-generated/haproxy"
self.add_copy_spec([
"/etc/haproxy/haproxy.cfg",
var_puppet_gen + "/etc/haproxy/haproxy.cfg"
])
self.add_copy_spec("/etc/haproxy/conf.d/*")
self.add_cmd_output("haproxy -f /etc/haproxy/haproxy.cfg -c")
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.
import glob
from sos.plugins import Plugin, RedHatPlugin
class GlusterBlock(Plugin, RedHatPlugin):
"""Gluster Block"""
plugin_name = 'gluster_block'
profiles = ('storage',)
packages = ("gluster-block",)
files = ("/usr/sbin/gluster-block",)
def setup(self):
# collect logs - apply log_size for any individual file
# all_logs takes precedence over logsize
if not self.get_option("all_logs"):
limit = self.get_option("log_size")
else:
limit = 0
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Nfs(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Network file system information
"""
plugin_name = 'nfs'
profiles = ('storage', 'network', 'nfs')
packages = ['nfs-utils']
def setup(self):
self.add_copy_spec([
"/etc/nfsmount.conf",
"/etc/idmapd.conf",
"/etc/nfs.conf",
"/proc/fs/nfsfs/servers",
"/proc/fs/nfsfs/volumes",
"/run/sysconfig/nfs-utils",
])
return
class DebianHeat(OpenStackHeat, DebianPlugin, UbuntuPlugin):
packages = (
'heat-api',
'heat-api-cfn',
'heat-api-cloudwatch',
'heat-common',
'heat-engine',
'python-heat',
'python-heatclient'
)
class RedHatHeat(OpenStackHeat, RedHatPlugin):
packages = ('openstack-selinux',)
'%(comp)s-server',
'python-%(comp)s',
'python-%(comp)sclient'
]
def check_enabled(self):
return self.is_installed("%s-common" % self.component_name)
def setup(self):
super(DebianNeutron, self).setup()
self.packages = self.gen_pkg_tuple(self.package_list_template)
self.add_copy_spec("/etc/sudoers.d/%s_sudoers" % self.component_name)
class RedHatNeutron(Neutron, RedHatPlugin):
"""OpenStack Neutron related information for Red Hat distributions
"""
package_list_template = [
'openstack-%(comp)s',
'openstack-%(comp)s-linuxbridge'
'openstack-%(comp)s-metaplugin',
'openstack-%(comp)s-openvswitch',
'openstack-%(comp)s-bigswitch',
'openstack-%(comp)s-brocade',
'openstack-%(comp)s-cisco',
'openstack-%(comp)s-hyperv',
'openstack-%(comp)s-midonet',
'openstack-%(comp)s-nec'
'openstack-%(comp)s-nicira',
'openstack-%(comp)s-plumgrid',