[virt-tools-list] [PATCH virt-manager 10/10] guest: Don't ignore invalid boot_order inputs

Marc Hartmayer mhartmay at linux.ibm.com
Wed Feb 6 09:55:43 UTC 2019


A `KeyError` indicates that the `boot_order` input was
invalid. Therefore we shouldn't ignore this error silently.

Signed-off-by: Marc Hartmayer <mhartmay at linux.ibm.com>
---
 virtinst/guest.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/virtinst/guest.py b/virtinst/guest.py
index 0ea99d3343da..46d27daca6e8 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -384,10 +384,7 @@ class Guest(XMLBuilder):
         dev_map = dict((dev.get_xml_id(), dev) for dev in
                        self.get_bootable_devices())
         for boot_idx, dev_xml_id in enumerate(boot_order, 1):
-            try:
-                dev_map[dev_xml_id].boot.order = boot_idx
-            except KeyError:
-                pass
+            dev_map[dev_xml_id].boot.order = boot_idx
 
     def set_boot_order(self, boot_order, legacy=False):
         """Modifies the boot order"""
-- 
2.17.0




More information about the virt-tools-list mailing list