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

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