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

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