aboutsummaryrefslogblamecommitdiffstats
path: root/test/commons.py
blob: de2906fd896f676415614299c188c993d5662465 (plain) (tree)































                                                                
# commons.py
import sys, os

commons = {}
commons['bin'] = '/usr/sbin/sosreport'
commons['fnameRe'] = '/tmp/sosreport-*.xz'
commons['testName'] = 'tester'
commons['testID'] = 1
commons['batch'] = True
commons['i18n'] = 'en_US.UTF-8'
commons['pluginpath'] = None
commons['plugins'] = []
commons['testOptions'] = ['--build','--batch']
if os.path.isfile('/etc/fedora-release'):
    commons['distro'] = 'Fedora'
else:
    commons['distro'] = 'RHEL'

paths = sys.path
for path in paths:
    if path.strip()[-len("site-packages"):] == "site-packages" \
    and os.path.isdir(path + "/sos/plugins"):
        commons['pluginpath'] = path + "/sos/plugins"

for plugin in os.listdir(commons['pluginpath']):
    plugbase =  plugin[:-3]
    if not plugin[-3:] == '.py' or plugbase == "__init__":
        continue
    commons['plugins'].append(plugbase) 

def desc(txt):
    sys.stdout.write(txt)