summaryrefslogtreecommitdiffstats
path: root/staslib/avahi.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-16 11:03:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-16 11:03:18 +0000
commit347467d3fa6fb239f917c05c4cf7f6c3fe7f9b30 (patch)
tree44ae9f59984c8a36b93f29a729f10473653f9f19 /staslib/avahi.py
parentAdding upstream version 2.2.2. (diff)
downloadnvme-stas-347467d3fa6fb239f917c05c4cf7f6c3fe7f9b30.tar.xz
nvme-stas-347467d3fa6fb239f917c05c4cf7f6c3fe7f9b30.zip
Adding upstream version 2.3~rc1.upstream/2.3_rc1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'staslib/avahi.py')
-rw-r--r--staslib/avahi.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/staslib/avahi.py b/staslib/avahi.py
index c8a3a0b..26543d9 100644
--- a/staslib/avahi.py
+++ b/staslib/avahi.py
@@ -29,9 +29,11 @@ def _txt2dict(txt: list):
for list_of_chars in txt:
try:
string = functools.reduce(lambda accumulator, c: accumulator + chr(c), list_of_chars, '')
- key, val = string.split("=")
- the_dict[key.lower()] = val
- except Exception: # pylint: disable=broad-except
+ if string.isprintable():
+ key, val = string.split('=')
+ if key: # Make sure the key is not an empty string
+ the_dict[key.lower()] = val
+ except ValueError:
pass
return the_dict