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

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