[virt-manager PATCH] create: fix a TypeError issue when detecting OS info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How to reproduce:
1) New VM -> Use ISO image
2) Choose a WINDOWS IMG

Then debug log shows:
Traceback (most recent call last):
File "/home/virt-manager/virtManager/create.py", line 1218, in change_os_version
      if os_type_model[idx][0] == type_row[0]:
File "/usr/lib64/python2.7/site-packages/gi/overrides/Gtk.py", line 1064, in __getitem__
      return self.model.get_value(self.iter, key)
TypeError: unknown type (null)

Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>
---
 virtManager/create.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/virtManager/create.py b/virtManager/create.py
index 038649d..b3ad674 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -1187,6 +1187,10 @@ class vmmCreate(vmmGObjectUI):
         type_row = self._selected_os_row()
         if not type_row:
             return
+        try:
+            Previous_row = type_row[0]
+        except TypeError:
+            Previous_row = None
 
         self.show_all_os = True
         self.populate_os_type_model()
@@ -1194,7 +1198,7 @@ class vmmCreate(vmmGObjectUI):
         os_type_list = self.widget("install-os-type")
         os_type_model = os_type_list.get_model()
         for idx in range(len(os_type_model)):
-            if os_type_model[idx][0] == type_row[0]:
+            if os_type_model[idx][0] == Previous_row:
                 os_type_list.set_active(idx)
                 break
 
-- 
1.9.0

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux