[Oval-commits] r81 - trunk/tools/oval/definition

Pavel Vinogradov blaze-guest at alioth.debian.org
Sat Jul 14 07:13:37 UTC 2007


Author: blaze-guest
Date: 2007-07-14 07:13:37 +0000 (Sat, 14 Jul 2007)
New Revision: 81

Modified:
   trunk/tools/oval/definition/generator.py
Log:
Generate usefully comments to dpkginfo_test nodes

Modified: trunk/tools/oval/definition/generator.py
===================================================================
--- trunk/tools/oval/definition/generator.py	2007-07-13 17:27:47 UTC (rev 80)
+++ trunk/tools/oval/definition/generator.py	2007-07-14 07:13:37 UTC (rev 81)
@@ -130,7 +130,7 @@
 				"version":"1", 
 				"check":"all",
 				"check_existence":"at_least_one_exists",
-				"comment":"none",
+				"comment":"%s is earlier than %s" % (name, version),
 				"xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"
 			})
 	test.appendChild ( __createXMLElement("object", attrs={"object_ref" : __createOVALObject (name)}))
@@ -143,23 +143,26 @@
 	""" Generate OVAL test for debian_version or architecture cases"""
 	
 	if not testsHash[testType].has_key(value):
-
+		comment = None
+		
 		ref = __getNewId("test")
 		
+		if testType == "release":
+			objectId = __createOVALObject ("debian_version")
+			comment = "Debian GNU/Linux %s is installed" % value
+		else:
+			objectId = __createOVALObject ("architecture")
+			comment = "Installed architecture is %s" % value
+			
 		test = __createXMLElement("dpkginfo_test", 
 				attrs={"id":ref, 
 					"version":"1", 
 					"check":"all",
 					"check_existence":"at_least_one_exists",
-					"comment":"none",
+					"comment":comment,
 					"xmlns":"http://oval.mitre.org/XMLSchema/oval-definitions-5#linux"
 			})
 		
-		if testType == "release":
-			objectId = __createOVALObject ("debian_version")
-		else:
-			objectId = __createOVALObject ("architecture")
-		
 		test.appendChild ( __createXMLElement("object", attrs={"object_ref" : objectId}))
 		test.appendChild ( __createXMLElement("state", attrs={"state_ref" : __createOVALState (value, "equals")}))
 		tests.appendChild(test)




More information about the Oval-commits mailing list