SECTION = "/var/log/messages"
	CONTENT = []
	Failure = re.compile("multipath.*failed path|multipath.*failing path|multipath.*mark as failed", re.IGNORECASE)
	if Core.getRegExSection(FILE_OPEN, SECTION, CONTENT):
		for LINE in CONTENT:
			if Failure.search(LINE):
				return True
	return False

##############################################################################
# Main Program Execution
##############################################################################

RPM_NAME = 'multipath-tools'
RPM_VERSION = '0.4.9-112.1'
if( SUSE.packageInstalled(RPM_NAME) ):
	INSTALLED_VERSION = SUSE.compareRPM(RPM_NAME, RPM_VERSION)
	if( INSTALLED_VERSION == 0 ):
		if( pathFailure() ):
			Core.updateStatus(Core.CRIT, "MPIO path failure detected, all paths will fail - update multipath-tools")
		else:
			Core.updateStatus(Core.WARN, "Susceptible to multiple MPIO path failures - update multipath-tools")
	else:
		Core.updateStatus(Core.IGNORE, "Bug fix applied for " + RPM_NAME)
else:
	Core.updateStatus(Core.ERROR, "ERROR: RPM package not installed: " + RPM_NAME)

Core.printPatternResults()


	section = "wbinfo -u"
	content = {}
	if Core.getSection(fileOpen, section, content):
		for line in content:
			#if something in section
			if "Error looking up domain users" in content[line]:
				return True
	return False


##############################################################################
# Main Program Execution
##############################################################################
if( SUSE.compareKernel(SUSE.SLE11SP2) >= 0 and SUSE.compareKernel(SUSE.SLE11SP3) < 0 ):
	if( SUSE.packageInstalled("samba") and SUSE.packageInstalled("samba-winbind") ):
		if( SUSE.compareRPM("samba", "3.6.3-0.30.1") == 0 ):
			if( winBindRunning() ):
				Core.updateStatus(Core.WARN, "Winbind AD lookups may fail, update system for newer Samba packages")
				if( winBindFailures() ):
					Core.updateStatus(Core.CRIT, "Winbind AD lookup failure, update system for newer Samba packages")
			else:
				Core.updateStatus(Core.ERROR, "Winbind service is not running, skipping test")
		else:
			Core.updateStatus(Core.ERROR, "Samba version has been verified, skipping test")
	else:
		Core.updateStatus(Core.ERROR, "Samba/Winbind not installed, skipping test")
else:
	Core.updateStatus(Core.ERROR, "Outside the kernel scope")

Core.printPatternResults()
##############################################################################

META_CLASS = "SLE"
META_CATEGORY = "SMT"
META_COMPONENT = "Repositories"
PATTERN_ID = os.path.basename(__file__)
PRIMARY_LINK = "META_LINK_TID"
OVERALL = Core.TEMP
OVERALL_INFO = "NOT SET"
OTHER_LINKS = "META_LINK_TID=https://www.suse.com/support/kb/doc.php?id=7015946|META_LINK_BUG=https://bugzilla.suse.com/show_bug.cgi?id=903847 "

Core.init(META_CLASS, META_CATEGORY, META_COMPONENT, PATTERN_ID, PRIMARY_LINK, OVERALL, OVERALL_INFO, OTHER_LINKS)

##############################################################################
# Main Program Execution
##############################################################################

RPM_NAME = 'smt'
AFFECTED_RPM_VERSION = '2.0.7-0.7.1'
if( SUSE.packageInstalled(RPM_NAME) ):
	INSTALLED_VERSION = SUSE.compareRPM(RPM_NAME, AFFECTED_RPM_VERSION)
	if( INSTALLED_VERSION <= 0 ):
		Core.updateStatus(Core.WARN, "The command smt-setup-custom-repos may fail with unknown column ID errors, update system resolve.")
	else:
		Core.updateStatus(Core.IGNORE, "Bug fixes applied for " + str(RPM_NAME) + ", AVOIDED")
else:
	Core.updateStatus(Core.ERROR, "ERROR: Package " + RPM_NAME + " not installed")

Core.printPatternResults()

	CRONS = 0
	if Core.getRegExSection(FILE_OPEN, SECTION, CONTENT):
		for LINE in CONTENT:
			if "cron" in LINE:
				CRONS += 1
				if( CRONS > 1 ):
					return True
	return False

##############################################################################
# Main Program Execution
##############################################################################

if( SUSE.packageInstalled('cronie') ):
	if( SUSE.packageInstalled('cron') ):
		CRONIE_VERSION = SUSE.compareRPM('cronie', '1.4.11-59')
		CRON_VERSION = SUSE.compareRPM('cron', '4.2-59')
		if( CRONIE_VERSION < 0 ):
			if( CRON_VERSION < 0 ):
				if( multipleCrons() ):
					Core.updateStatus(Core.CRIT, "Multiple instances of cron running, update system to resolve")
				else:
					Core.updateStatus(Core.WARN, "Multiple instances of cron will incorrectly be allowed to run, update system to avoid")
			else:
				Core.updateStatus(Core.WARN, "Both cronie and cron packages should be updated together")
		else:
			if( CRON_VERSION < 0 ):
				Core.updateStatus(Core.WARN, "Both cronie and cron packages should be updated together")
			else:
				Core.updateStatus(Core.IGNORE, "Updated cronie and cron packages avoid bsc#1017160")
	else:
	content = {}
	if Core.getSection(fileOpen, section, content):
		for line in content:
			if "mcelog: Failed to set imc_log on cpu" in content[line]:
				return True
	return False

##############################################################################
# Main Program Execution
##############################################################################

PACKAGE = 'mcelog'
VERSION = '1.0.2013.01.18-0.11.9'
if( SUSE.compareKernel(SUSE.SLE11SP3) >= 0 and SUSE.compareKernel(SUSE.SLE11SP4) < 0 ):
	if( SUSE.packageInstalled(PACKAGE) ):
		if( SUSE.compareRPM(PACKAGE, VERSION) <= 0 ):
			if( vmwareFound() ):
				if( mceLoadError() ):
					Core.updateStatus(Core.CRIT, "Service " + PACKAGE + " failed to start")
				else:
					Core.updateStatus(Core.WARN, "Service " + PACKAGE + " may fail to start")
			else:
				Core.updateStatus(Core.ERROR, "Error: Missing VMware Machine, skipping mcelog check")
		else:
			Core.updateStatus(Core.ERROR, "Valid version of " + PACKAGE + " installed, AVOIDED")
	else:
		Core.updateStatus(Core.ERROR, "Error: " + PACKAGE + " package not installed, skipping mcelog check")
else:
	Core.updateStatus(Core.ERROR, "Error: Outside kernel scope, skipping mcelog check")
Core.printPatternResults()
def intelCard():
	fileOpen = "x.txt"
	section = "sysp -c"
	content = {}
	if Core.getSection(fileOpen, section, content):
		for line in content:
			if "Intel" in content[line]:
				return True
	return False

##############################################################################
# Main Program Execution
##############################################################################

if( SUSE.compareKernel(SUSE.SLE11SP3) >= 0 and SUSE.compareKernel(SUSE.SLE11SP4) < 0 ):
	if( SUSE.packageInstalled('Mesa') ):
		if( SUSE.compareRPM('Mesa', '9.0.3-0.19.1') <= 0 ):
			if( intelCard() ):
				Core.updateStatus(Core.WARN, "GLX applications may fail to start")
			else:
				Core.updateStatus(Core.ERROR, "Error: Invalid graphics card, skipping")
		else:
			Core.updateStatus(Core.ERROR, "Valid version of Mesa installed, AVOIDED")
	else:
		Core.updateStatus(Core.ERROR, "Error: Mesa package not installed, skipping")
else:
	Core.updateStatus(Core.ERROR, "Error: Outside kernel scope, skipping")
Core.printPatternResults()