Skip to content

Commit

Permalink
copr: don't traceback on empty lines in /etc/os-release
Browse files Browse the repository at this point in the history
Fix RHBZ 1994944
  • Loading branch information
FrostyX authored and xsuchy committed Oct 13, 2021
1 parent 99a9df5 commit fd8f0e2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugins/copr.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ def linux_distribution():
with open('/etc/os-release') as os_release_file:
os_release_data = {}
for line in os_release_file:
os_release_key, os_release_value = line.rstrip().split('=')
os_release_data[os_release_key] = os_release_value.strip('"')
try:
os_release_key, os_release_value = line.rstrip().split('=')
os_release_data[os_release_key] = os_release_value.strip('"')
except ValueError:
# Skip empty lines and everything that is not a simple
# variable assignment
pass
return (os_release_data['NAME'], os_release_data['VERSION_ID'], None)

PLUGIN_CONF = 'copr'
Expand Down

0 comments on commit fd8f0e2

Please sign in to comment.