diff options
-rw-r--r-- | ncserver/module/nms_ifupdownng.py | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/ncserver/module/nms_ifupdownng.py b/ncserver/module/nms_ifupdownng.py index 70fadd9..ab658f6 100644 --- a/ncserver/module/nms_ifupdownng.py +++ b/ncserver/module/nms_ifupdownng.py @@ -88,7 +88,7 @@ def _save_unlocked(): buf = "iface " + iface + "\n" for item in _CONFIG[iface]: for key, val in item.items(): - if key.casefold() == 'auto'.casefold() and \ + if key == 'auto' and \ (val is True or val.lower()[0] == 't'): buf = "auto " + iface + "\n" + buf continue @@ -118,9 +118,8 @@ def _find_one(iface: str, key: str): return None for item in _CONFIG[iface]: - for candidate in item.keys(): - if key.casefold() == candidate.casefold(): - return item[candidate] + if key in item.keys(): + return item[key] return None @@ -133,9 +132,8 @@ def _find_many(iface: str, key: str) -> list: return None for item in _CONFIG[iface]: - for candidate in item.keys(): - if key.casefold() == candidate.casefold(): - ret.append(item[candidate]) + if key in item.keys(): + ret.append(item[key]) return ret @@ -144,11 +142,10 @@ def _replace_one(iface: str, key: str, value: str): """Replace a single instance of +key+ for +iface+ with +value+.""" iface_cfg = _CONFIG[iface] for item in iface_cfg: - for candidate in item.keys(): - if key.casefold() == candidate.casefold(): - item[candidate] = value - _save() - return + if key in item.keys(): + item[key] = value + _save() + return iface_cfg.append({key: value}) _save() @@ -159,11 +156,10 @@ def _remove_one(iface: str, key: str): """Remove a single instance of +key+ from +iface+.""" iface_cfg = _CONFIG[iface] for item in iface_cfg: - for candidate in item.keys(): - if key.casefold() == candidate.casefold(): - iface_cfg.remove(item) - _save() - return + if key in item.keys(): + iface_cfg.remove(item) + _save() + return ############################# |