2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-26 02:48:52 +00:00

Ignore unparseable net config files

If some pre-processing has rendered config files
unparseable, ignore the file as we can't intelligently rewrite
those.
This commit is contained in:
Jarrod Johnson 2024-12-13 16:16:12 -05:00
parent 8e0bc43008
commit cd2509c485

View File

@ -226,7 +226,11 @@ class WickedManager(object):
self.cfgbydev[devname] = currcfg
for cfg in open(ifcfg).read().splitlines():
cfg = cfg.split('#', 1)[0]
kv = ' '.join(shlex.split(cfg)).split('=', 1)
try:
kv = ' '.join(shlex.split(cfg)).split('=', 1)
except Exception:
# unparseable line, likely having something we can't handle
del self.cfgbydev[devname]
if len(kv) != 2:
continue
k, v = kv