From a57be7d30897ecf301de673e41d1af975b4f593b Mon Sep 17 00:00:00 2001
From: Jiri Konecny <jkonecny@redhat.com>
Date: Wed, 29 Jul 2020 14:12:51 +0200
Subject: [PATCH] Fix issue that treeinfo repositories were never disabled

The add_repo() method always enable repository at the end. We should improve
this correctly in the upstream to avoid the confusion.

Related: rhbz#1851207
(cherry picked from commit d26f4e4cd054288360993220bc9cee4b7abf5ddc)
---
 pyanaconda/payload/dnf/payload.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/payload/dnf/payload.py b/pyanaconda/payload/dnf/payload.py
index 02a66cd25..56c52f54e 100644
--- a/pyanaconda/payload/dnf/payload.py
+++ b/pyanaconda/payload/dnf/payload.py
@@ -1852,7 +1852,11 @@ class DNFPayload(Payload):
                     repo.treeinfo_origin = True
                     log.debug("Adding new treeinfo repository: %s enabled: %s",
                               repo_md.name, repo_enabled)
-                    self.add_repo(repo)
+
+                    if repo_enabled:
+                        self.add_repo(repo)
+                    else:
+                        self.add_disabled_repo(repo)
 
     def _cleanup_old_treeinfo_repositories(self):
         """Remove all old treeinfo repositories before loading new ones.
-- 
2.23.0

