[Libvirt-cim] [PATCH] [TEST] Add some checking to SLP test to prevent an exception

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Dec 1 23:09:04 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1259708930 28800
# Node ID c41efe792299a52836852b2ebd9677b4dbbe9395
# Parent  95f878569bfcf1c437f8d7230beee0876b5fffe0
[TEST] Add some checking to SLP test to prevent an exception

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 95f878569bfc -r c41efe792299 suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py
--- a/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py	Tue Dec 01 10:53:39 2009 -0800
+++ b/suites/libvirt-cim/cimtest/Profile/04_verify_libvirt_cim_slp_profiles.py	Tue Dec 01 15:08:50 2009 -0800
@@ -89,7 +89,11 @@
         lines = line.split("RegisteredProfilesSupported")
         dmtf_profiles = lines[1].split("DMTF")
         for profile in dmtf_profiles:
-            temp_reg_ele =  profile.rsplit(":", 1)[1].rstrip(",")
+            tmp_prof =  profile.rsplit(":", 1)
+            if len(tmp_prof) < 2:
+                return []
+
+            temp_reg_ele =  tmp_prof[1].rstrip(",")
             reg_prof_name = temp_reg_ele.rstrip(")")
             slp_profile_list.append(reg_prof_name)
 
@@ -147,6 +151,10 @@
 
     slp_profile_list = filter_reg_name_from_slp(slp_attrs)
 
+    if len(slp_profile_list) < 1:
+        logger.error("Failed to get profile list on %s", server)
+        return status
+
     status, libvirt_cim_reg_list = get_libvirt_cim_profile_info(server, virt)
     if status != PASS:
         logger.error("Failed to enumerate profile information on %s", server)




More information about the Libvirt-cim mailing list