netgod / rpms / anaconda

Forked from rpms/anaconda 2 years ago
Clone
Blob Blame History Raw
From 1ca30ca30dbb5b19139d6ce5bfc9560dea089ebf Mon Sep 17 00:00:00 2001
From: Vendula Poncova <vponcova@redhat.com>
Date: Fri, 27 Nov 2020 13:30:53 +0100
Subject: [PATCH 20002/20007] Define the updates repositories in the Anaconda
 configuration files (#1642513)

Replace the enable_updates configuration option with the updates_repositories
configuration option. Installation of latest updates will be enabled if there
are some updates repositories defined in the configuration files.

Resolves: rhbz#1642513

(cherry picked from commit 95dfc2e91e3de3721624ded7cf33ec947c19a3a7)
---
 data/anaconda.conf                              |  4 ++--
 data/product.d/fedora.conf                      |  4 ++++
 data/product.d/rhel.conf                        |  1 -
 data/product.d/scientific-linux.conf            |  5 ++++-
 pyanaconda/core/configuration/payload.py        | 15 ++++++++-------
 pyanaconda/core/constants.py                    |  4 ----
 pyanaconda/payload/dnf/payload.py               |  4 ++--
 pyanaconda/ui/gui/spokes/installation_source.py |  2 +-
 8 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/data/anaconda.conf b/data/anaconda.conf
index ab6c15bb6..1508a7a8a 100644
--- a/data/anaconda.conf
+++ b/data/anaconda.conf
@@ -68,8 +68,8 @@ default_environment =
 # List of ignored packages.
 ignored_packages =
 
-# Enable installation of latest updates.
-enable_updates = True
+# Names of repositories that provide latest updates.
+updates_repositories =
 
 # List of .treeinfo variant types to enable.
 # Valid items:
diff --git a/data/product.d/fedora.conf b/data/product.d/fedora.conf
index 31a9245c0..f0a307113 100644
--- a/data/product.d/fedora.conf
+++ b/data/product.d/fedora.conf
@@ -19,3 +19,7 @@ default_help_pages =
 [Payload]
 default_rpm_gpg_keys =
     /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
+
+updates_repositories =
+    updates
+    updates-modular
diff --git a/data/product.d/rhel.conf b/data/product.d/rhel.conf
index c4de9b6a8..629ba172b 100644
--- a/data/product.d/rhel.conf
+++ b/data/product.d/rhel.conf
@@ -33,7 +33,6 @@ ignored_packages =
     btrfs-progs
     dmraid
 
-enable_updates = False
 enable_closest_mirror = False
 default_source = CDN
 
diff --git a/data/product.d/scientific-linux.conf b/data/product.d/scientific-linux.conf
index e8393e633..c5bd8121a 100644
--- a/data/product.d/scientific-linux.conf
+++ b/data/product.d/scientific-linux.conf
@@ -20,9 +20,12 @@ kickstart_modules =
      org.fedoraproject.Anaconda.Modules.Services
 
 [Payload]
-enable_updates = True
 default_source = CLOSEST_MIRROR
 
+updates_repositories =
+    updates
+    updates-modular
+
 [User Interface]
 help_directory = /usr/share/anaconda/help/sl
 default_help_pages =
diff --git a/pyanaconda/core/configuration/payload.py b/pyanaconda/core/configuration/payload.py
index 4cc2c0244..de521e009 100644
--- a/pyanaconda/core/configuration/payload.py
+++ b/pyanaconda/core/configuration/payload.py
@@ -41,16 +41,17 @@ class PayloadSection(Section):
         return self._get_option("ignored_packages", str).split()
 
     @property
-    def enable_updates(self):
-        """Enable installation of latest updates.
+    def updates_repositories(self):
+        """List of names of repositories that provide latest updates.
 
-        This flag controls whether or not Anaconda should provide an option to
-        install the latest updates during installation source selection.
+        This option also controls whether or not Anaconda should provide
+        an option to install the latest updates during installation source
+        selection.
 
-        The installation of latest updates is selected by default, if the closest
-        mirror is selected, and the "updates" repo is enabled.
+        The installation of latest updates is selected by default, if
+        the closest mirror is selected, and the "updates" repo is enabled.
         """
-        return self._get_option("enable_updates", bool)
+        return self._get_option("updates_repositories", str).split()
 
     @property
     def enabled_repositories_from_treeinfo(self):
diff --git a/pyanaconda/core/constants.py b/pyanaconda/core/constants.py
index f6b433062..b413a55fd 100644
--- a/pyanaconda/core/constants.py
+++ b/pyanaconda/core/constants.py
@@ -63,10 +63,6 @@ DEFAULT_REPOS = [productName.split('-')[0].lower(),
                  "BaseOS",  # Used by RHEL
                  "baseos"]  # Used by CentOS Stream
 
-# Get list of repo names which should be used as updates repos
-DEFAULT_UPDATE_REPOS = ["updates",
-                        "updates-modular"]
-
 DBUS_ANACONDA_SESSION_ADDRESS = "DBUS_ANACONDA_SESSION_BUS_ADDRESS"
 
 ANACONDA_BUS_CONF_FILE = "/usr/share/anaconda/dbus/anaconda-bus.conf"
diff --git a/pyanaconda/payload/dnf/payload.py b/pyanaconda/payload/dnf/payload.py
index ac717e793..f091cfe53 100644
--- a/pyanaconda/payload/dnf/payload.py
+++ b/pyanaconda/payload/dnf/payload.py
@@ -1135,10 +1135,10 @@ class DNFPayload(Payload):
 
         # Enable or disable updates.
         if self._updates_enabled:
-            for repo in constants.DEFAULT_UPDATE_REPOS:
+            for repo in conf.payload.updates_repositories:
                 self.enable_repo(repo)
         else:
-            for repo in constants.DEFAULT_UPDATE_REPOS:
+            for repo in conf.payload.updates_repositories:
                 self.disable_repo(repo)
 
         # Disable updates-testing.
diff --git a/pyanaconda/ui/gui/spokes/installation_source.py b/pyanaconda/ui/gui/spokes/installation_source.py
index d0d4da72b..a5d89e1c2 100644
--- a/pyanaconda/ui/gui/spokes/installation_source.py
+++ b/pyanaconda/ui/gui/spokes/installation_source.py
@@ -776,7 +776,7 @@ class SourceSpoke(NormalSpoke, GUISpokeInputCheckHandler, SourceSwitchHandler):
         self._network_button.connect("toggled", self._update_url_entry_check)
 
         # Show or hide the updates option based on the configuration
-        if conf.payload.enable_updates:
+        if conf.payload.updates_repositories:
             really_show(self._updates_box)
         else:
             really_hide(self._updates_box)
-- 
2.31.1