def notFixed():
	fileOpen = "boot.txt"
	section = "/proc/cmdline"
	content = {}
	SERVER = SUSE.getHostInfo()
#	print "SERVER = " + str(SERVER)
	if( SERVER['DistroVersion'] == 11 ):
		if( SERVER['DistroPatchLevel'] == 3 ):
			FIXED_VERSION = '3.0.101-0.21'
		elif( SERVER['DistroPatchLevel'] == 2 ):
			FIXED_VERSION = '3.0.101-0.7.19'
		else:
			Core.updateStatus(Core.ERROR, "Outside Service Pack scope, skipping IRQ remap test")
			return False

		if( SUSE.compareKernel(FIXED_VERSION) >= 0 ):
			Core.updateStatus(Core.IGNORE, "Patch applied, IRQ remap issue AVOIDED")
			return False
	else:
		Core.updateStatus(Core.ERROR, "Outside Distribution scope, skipping IRQ remap test")
		return False
		
	if Core.getSection(fileOpen, section, content):
		for line in content:
			if "intremap=off" in content[line]:
				Core.updateStatus(Core.IGNORE, "Found interrupt remapping issue intremap=off work around")
				return False
	return True
def kernelAffected():
	SERVER = SUSE.getHostInfo()
	if( SERVER['DistroVersion'] == 11 ):
		if( SERVER['DistroPatchLevel'] == 2 ):
			KERNEL_VERSION = '3.0.38-0.5'
		elif( SERVER['DistroPatchLevel'] == 1 ):
			KERNEL_VERSION = '2.6.32.59-0.7'
		else:
			KERNEL_VERSION = SERVER['KernelVersion']
		INSTALLED_VERSION = SUSE.compareKernel(KERNEL_VERSION)
		if( INSTALLED_VERSION < 0 ):
			return True
	return False
META_CATEGORY = "SLE"
META_COMPONENT = "kgraft-patch"
PATTERN_ID = os.path.basename(__file__)
PRIMARY_LINK = "META_LINK_Security"
OVERALL = Core.TEMP
OVERALL_INFO = "NOT SET"
OTHER_LINKS = "META_LINK_Security=https://lists.opensuse.org/opensuse-security-announce/2018-05/msg00043.html"
Core.init(META_CLASS, META_CATEGORY, META_COMPONENT, PATTERN_ID, PRIMARY_LINK, OVERALL, OVERALL_INFO, OTHER_LINKS)

LTSS = True
NAME = 'kgraft-patch'
MAIN = ''
SEVERITY = 'Important'
TAG = 'SUSE-SU-2018:1243-1'
PACKAGES = {}
SERVER = SUSE.getHostInfo()

if ( SERVER['DistroVersion'] == 12):
	if ( SERVER['DistroPatchLevel'] == 0 ):
		PACKAGES = {
			'kgraft-patch-3_12_61-52_72-default': '10-2.1',
			'kgraft-patch-3_12_61-52_72-xen': '10-2.1',
		}
		SUSE.securityAnnouncementPackageCheck(NAME, MAIN, LTSS, SEVERITY, TAG, PACKAGES)
	else:
		Core.updateStatus(Core.ERROR, "ERROR: " + NAME + " Security Announcement: Outside the service pack scope")
else:
	Core.updateStatus(Core.ERROR, "ERROR: " + NAME + " Security Announcement: Outside the distribution scope")
Core.printPatternResults()