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

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