59 lines
2.5 KiB
Diff
59 lines
2.5 KiB
Diff
From aed1a9cafbebcdcfa463b15e52f53a6ac7730f01 Mon Sep 17 00:00:00 2001
|
|
From: Lubomir Rintel <lkundrak@v3.sk>
|
|
Date: Mon, 26 Sep 2022 11:59:06 +0200
|
|
Subject: [PATCH 72/75] Make IfCfgScanner accept simple quoted values
|
|
|
|
Turns out people actually use those.
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=2111691
|
|
---
|
|
.../actors/ifcfgscanner/libraries/ifcfgscanner.py | 6 ++++++
|
|
.../actors/ifcfgscanner/tests/unit_test_ifcfgscanner.py | 8 ++++++--
|
|
2 files changed, 12 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/repos/system_upgrade/el8toel9/actors/ifcfgscanner/libraries/ifcfgscanner.py b/repos/system_upgrade/el8toel9/actors/ifcfgscanner/libraries/ifcfgscanner.py
|
|
index cfc385dc..683327b3 100644
|
|
--- a/repos/system_upgrade/el8toel9/actors/ifcfgscanner/libraries/ifcfgscanner.py
|
|
+++ b/repos/system_upgrade/el8toel9/actors/ifcfgscanner/libraries/ifcfgscanner.py
|
|
@@ -28,6 +28,12 @@ def process_ifcfg(filename, secrets=False):
|
|
# simple assignments. Play it safe.
|
|
continue
|
|
|
|
+ # Deal with simple quoting. We don't expand anything, nor do
|
|
+ # multiline strings or anything of that sort.
|
|
+ if value is not None and len(value) > 1 and value[0] == value[-1]:
|
|
+ if value.startswith('"') or value.startswith("'"):
|
|
+ value = value[1:-1]
|
|
+
|
|
properties.append(IfCfgProperty(name=name, value=value))
|
|
return properties
|
|
|
|
diff --git a/repos/system_upgrade/el8toel9/actors/ifcfgscanner/tests/unit_test_ifcfgscanner.py b/repos/system_upgrade/el8toel9/actors/ifcfgscanner/tests/unit_test_ifcfgscanner.py
|
|
index f5e3056a..d3b4846f 100644
|
|
--- a/repos/system_upgrade/el8toel9/actors/ifcfgscanner/tests/unit_test_ifcfgscanner.py
|
|
+++ b/repos/system_upgrade/el8toel9/actors/ifcfgscanner/tests/unit_test_ifcfgscanner.py
|
|
@@ -55,8 +55,8 @@ def test_ifcfg1(monkeypatch):
|
|
TYPE=Wireless # Some comment
|
|
# Another comment
|
|
ESSID=wep1
|
|
- NAME=wep1
|
|
- MODE=Managed
|
|
+ NAME="wep1"
|
|
+ MODE='Managed' # comment
|
|
WEP_KEY_FLAGS=ask
|
|
SECURITYMODE=open
|
|
DEFAULTKEY=1
|
|
@@ -81,6 +81,10 @@ def test_ifcfg1(monkeypatch):
|
|
assert ifcfg.properties[0].value == "Wireless"
|
|
assert ifcfg.properties[1].name == "ESSID"
|
|
assert ifcfg.properties[1].value == "wep1"
|
|
+ assert ifcfg.properties[2].name == "NAME"
|
|
+ assert ifcfg.properties[2].value == "wep1"
|
|
+ assert ifcfg.properties[3].name == "MODE"
|
|
+ assert ifcfg.properties[3].value == "Managed"
|
|
|
|
|
|
def test_ifcfg2(monkeypatch):
|
|
--
|
|
2.39.0
|
|
|