Skip to content

Commit

Permalink
Handle newline in /etc/os-release
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mkenigs authored and nyh committed Dec 6, 2020
1 parent 8ed8868 commit 6759936
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/linux_distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ def linux_distribution():
def parse_file(f):
res = {}
for line in f:
k, v = line.rstrip().split('=')
res[k] = v.strip('"')
stripped = line.rstrip()
if stripped:
k, v = stripped.split('=')
res[k] = v.strip('"')
return res

try:
Expand Down

0 comments on commit 6759936

Please sign in to comment.