From cbd1db6b484fe9b7c0ec2a042c8d9a4d1b1352c5 Mon Sep 17 00:00:00 2001 From: Emilian Bogdan Date: Fri, 23 Jan 2026 01:02:18 +0200 Subject: [PATCH 1/2] Fix missing TYPE value for ifcfg files Handle cases where TYPE is present but empty, as well as when TYPE is missing entirely from the ifcfg file. --- coriolis/osmorphing/netpreserver/ifcfg.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coriolis/osmorphing/netpreserver/ifcfg.py b/coriolis/osmorphing/netpreserver/ifcfg.py index 3dc0a5ec..a9859f4c 100644 --- a/coriolis/osmorphing/netpreserver/ifcfg.py +++ b/coriolis/osmorphing/netpreserver/ifcfg.py @@ -52,6 +52,8 @@ def _get_ifcfgs_by_type(self, ifcfg_type, network_scripts_path): ifcfgs = [] for ifcfg_file in self._get_net_config_files(network_scripts_path): ifcfg = self.osmorphing_tool._read_config_file_sudo(ifcfg_file) + if not ifcfg.get("TYPE"): + ifcfg["TYPE"] = "Ethernet" if ifcfg.get("TYPE") == ifcfg_type: ifcfgs.append((ifcfg_file, ifcfg)) return ifcfgs From f819fc1107332a84e6f3b53027d0c8e9dbd78091 Mon Sep 17 00:00:00 2001 From: Emilian Bogdan Date: Mon, 26 Jan 2026 01:31:00 +0200 Subject: [PATCH 2/2] Case sensitive and dict possible conflicts coverage Adding requested changes after testing the functionality, including the case sensitive coverage and preventing any dict unexpected behaviors. --- coriolis/osmorphing/netpreserver/ifcfg.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/coriolis/osmorphing/netpreserver/ifcfg.py b/coriolis/osmorphing/netpreserver/ifcfg.py index a9859f4c..ad2f01b8 100644 --- a/coriolis/osmorphing/netpreserver/ifcfg.py +++ b/coriolis/osmorphing/netpreserver/ifcfg.py @@ -52,8 +52,10 @@ def _get_ifcfgs_by_type(self, ifcfg_type, network_scripts_path): ifcfgs = [] for ifcfg_file in self._get_net_config_files(network_scripts_path): ifcfg = self.osmorphing_tool._read_config_file_sudo(ifcfg_file) - if not ifcfg.get("TYPE"): - ifcfg["TYPE"] = "Ethernet" - if ifcfg.get("TYPE") == ifcfg_type: + detected_type = ifcfg.get('TYPE') + if not detected_type: + detected_type = "Ethernet" + ifcfg["TYPE"] = detected_type + if detected_type.lower() == ifcfg_type.lower(): ifcfgs.append((ifcfg_file, ifcfg)) return ifcfgs