Blame SOURCES/0002-Add-a-warning-when-using-system-upgrade-on-RHEL.patch

213991
From 307641a869134de4ebd496d1a78e5ff128a26293 Mon Sep 17 00:00:00 2001
213991
From: Jan Kolarik <jkolarik@redhat.com>
213991
Date: Fri, 30 Sep 2022 11:36:26 +0000
213991
Subject: [PATCH 2/4] Add a warning when using `system-upgrade` on RHEL
213991
213991
---
213991
 dnf-plugins-core.spec     | 3 +--
213991
 doc/system-upgrade.rst    | 6 ++++--
213991
 plugins/system_upgrade.py | 4 ++++
213991
 3 files changed, 9 insertions(+), 4 deletions(-)
213991
213991
diff --git a/dnf-plugins-core.spec b/dnf-plugins-core.spec
213991
index 4df6e44..1ee87a1 100644
213991
--- a/dnf-plugins-core.spec
213991
+++ b/dnf-plugins-core.spec
213991
@@ -148,14 +148,13 @@ Summary:    Core Plugins for DNF
213991
 %{?python_provide:%python_provide python3-%{name}}
213991
 BuildRequires:  python3-dbus
213991
 BuildRequires:  python3-devel
213991
+BuildRequires:  python3-distro
213991
 BuildRequires:  python3-dnf >= %{dnf_lowest_compatible}
213991
 BuildRequires:  python3-systemd
213991
 BuildRequires:  pkgconfig(systemd)
213991
 BuildRequires:  systemd
213991
 %{?systemd_ordering}
213991
-%if 0%{?fedora}
213991
 Requires:       python3-distro
213991
-%endif
213991
 Requires:       python3-dbus
213991
 Requires:       python3-dnf >= %{dnf_lowest_compatible}
213991
 Requires:       python3-hawkey >= %{hawkey_version}
213991
diff --git a/doc/system-upgrade.rst b/doc/system-upgrade.rst
213991
index 3110460..87b7319 100644
213991
--- a/doc/system-upgrade.rst
213991
+++ b/doc/system-upgrade.rst
213991
@@ -27,13 +27,15 @@ DNF system-upgrades plugin provides three commands: ``system-upgrade``, ``offlin
213991
 ``offline-distrosync``. Only ``system-upgrade`` command requires increase of distribution major
213991
 version (``--releasever``) compared to installed version.
213991
 
213991
-``dnf system-upgrade`` can be used to upgrade a Fedora system to a new major
213991
-release. It replaces fedup (the old Fedora Upgrade tool). Before you proceed ensure that your system
213991
+``dnf system-upgrade`` is a recommended way to upgrade a system to a new major release.
213991
+It replaces fedup (the old Fedora Upgrade tool). Before you proceed ensure that your system
213991
 is fully upgraded (``dnf --refresh upgrade``).
213991
 
213991
 The ``system-upgrade`` command also performes additional actions necessary for the upgrade of the
213991
 system, for example an upgrade of groups and environments.
213991
 
213991
+.. WARNING:: The ``system-upgrade`` command is not supported on the RHEL distribution.
213991
+
213991
 --------
213991
 Synopsis
213991
 --------
213991
diff --git a/plugins/system_upgrade.py b/plugins/system_upgrade.py
213991
index fee6762..0baf978 100644
213991
--- a/plugins/system_upgrade.py
213991
+++ b/plugins/system_upgrade.py
213991
@@ -20,6 +20,7 @@
213991
 """system_upgrade.py - DNF plugin to handle major-version system upgrades."""
213991
 
213991
 from subprocess import call, Popen, check_output, CalledProcessError
213991
+import distro
213991
 import json
213991
 import os
213991
 import os.path
213991
@@ -451,6 +452,9 @@ class SystemUpgradeCommand(dnf.cli.Command):
213991
 
213991
     def configure_download(self):
213991
         if 'system-upgrade' == self.opts.command or 'fedup' == self.opts.command:
213991
+            if distro.id() == 'rhel':
213991
+                logger.warning(_('WARNING: this operation is not supported on the RHEL distribution. '
213991
+                                 'Proceed at your own risk.'))
213991
             help_url = get_url_from_os_release()
213991
             if help_url:
213991
                 msg = _('Additional information for System Upgrade: {}')
213991
-- 
213991
2.38.1
213991