From a8f359181632e5677dd01663d2778e1e0c1956f6 Mon Sep 17 00:00:00 2001
From: Tim Lauridsen <tla@rasmil.dk>
Date: Wed, 29 Sep 2021 07:35:42 +0200
Subject: [PATCH] Make GetRepo, handle missing repo options, with out breaking

---
 python/dnfdaemon/server/__init__.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/python/dnfdaemon/server/__init__.py b/python/dnfdaemon/server/__init__.py
index d41885c..98d278a 100644
--- a/python/dnfdaemon/server/__init__.py
+++ b/python/dnfdaemon/server/__init__.py
@@ -346,8 +346,14 @@ class DnfDaemonBase(dbus.service.Object, DownloadCallback):
         value = json.dumps(None)
         repo = self.base.repos.get(repo_id, None)  # get the repo object
         if repo:
-            # VectorString is not JSON serializable let's convert to list
-            repo_conf = dict([(c, getattr(repo, c) if 'VectorString' not in str(type(getattr(repo, c))) else list(getattr(repo, c))) for c in optionKeys])
+            repo_conf = {}
+            for c in optionKeys:
+                if hasattr(repo,c):
+                    value = getattr(repo, c)
+                    # VectorString is not JSON serializable let's convert to list
+                    if 'VectorString' in str(type(value)):
+                        value = list(value)
+                    repo_conf[c] = value
 
             enab = repo.enabled
             if not enab:
-- 
GitLab