Blame SOURCES/0004-copr-dont-traceback-on-empty-lines-in-etcos-release.patch

5a4a77
From ebacba86979d16cdb92ace9d7dc601a85c97b5db Mon Sep 17 00:00:00 2001
5a4a77
From: Jakub Kadlcik <frostyx@email.cz>
5a4a77
Date: Tue, 12 Oct 2021 18:30:47 +0200
5a4a77
Subject: [PATCH] copr: don't traceback on empty lines in /etc/os-release
5a4a77
5a4a77
Fix RHBZ 1994944
5a4a77
---
5a4a77
 plugins/copr.py |  9 +++++++--
5a4a77
 1 file changed, 7 insertions(+), 2 deletions(-)
5a4a77
5a4a77
diff --git a/plugins/copr.py b/plugins/copr.py
5a4a77
index 4644495..8841f03 100644
5a4a77
--- a/plugins/copr.py
5a4a77
+++ b/plugins/copr.py
5a4a77
@@ -50,8 +50,13 @@ except ImportError:
5a4a77
             with open('/etc/os-release') as os_release_file:
5a4a77
                 os_release_data = {}
5a4a77
                 for line in os_release_file:
5a4a77
-                    os_release_key, os_release_value = line.rstrip().split('=')
5a4a77
-                    os_release_data[os_release_key] = os_release_value.strip('"')
5a4a77
+                    try:
5a4a77
+                        os_release_key, os_release_value = line.rstrip().split('=')
5a4a77
+                        os_release_data[os_release_key] = os_release_value.strip('"')
5a4a77
+                    except ValueError:
5a4a77
+                        # Skip empty lines and everything that is not a simple
5a4a77
+                        # variable assignment
5a4a77
+                        pass
5a4a77
                 return (os_release_data['NAME'], os_release_data['VERSION_ID'], None)
5a4a77
 
5a4a77
 PLUGIN_CONF = 'copr'
5a4a77
--
5a4a77
libgit2 1.0.1
5a4a77