Skip to content

Commit 6759936

Browse files
mkenigsnyh
authored andcommitted
Handle newline in /etc/os-release
Current code assumes every line can be split on "=" which throws an exception for newlines Signed-off-by: Matthew Kenigsberg <[email protected]> Message-Id: <[email protected]>
1 parent 8ed8868 commit 6759936

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/linux_distro.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ def linux_distribution():
44
def parse_file(f):
55
res = {}
66
for line in f:
7-
k, v = line.rstrip().split('=')
8-
res[k] = v.strip('"')
7+
stripped = line.rstrip()
8+
if stripped:
9+
k, v = stripped.split('=')
10+
res[k] = v.strip('"')
911
return res
1012

1113
try:

0 commit comments

Comments
 (0)