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

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