Toshaan Bharvani
11 months ago
commit
6ea0c0ae7d
12 changed files with 10041 additions and 0 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
From 307641a869134de4ebd496d1a78e5ff128a26293 Mon Sep 17 00:00:00 2001 |
||||
From: Jan Kolarik <jkolarik@redhat.com> |
||||
Date: Fri, 30 Sep 2022 11:36:26 +0000 |
||||
Subject: [PATCH 2/4] Add a warning when using `system-upgrade` on RHEL |
||||
|
||||
--- |
||||
dnf-plugins-core.spec | 3 +-- |
||||
doc/system-upgrade.rst | 6 ++++-- |
||||
plugins/system_upgrade.py | 4 ++++ |
||||
3 files changed, 9 insertions(+), 4 deletions(-) |
||||
|
||||
diff --git a/dnf-plugins-core.spec b/dnf-plugins-core.spec |
||||
index 4df6e44..1ee87a1 100644 |
||||
--- a/dnf-plugins-core.spec |
||||
+++ b/dnf-plugins-core.spec |
||||
@@ -148,14 +148,13 @@ Summary: Core Plugins for DNF |
||||
%{?python_provide:%python_provide python3-%{name}} |
||||
BuildRequires: python3-dbus |
||||
BuildRequires: python3-devel |
||||
+BuildRequires: python3-distro |
||||
BuildRequires: python3-dnf >= %{dnf_lowest_compatible} |
||||
BuildRequires: python3-systemd |
||||
BuildRequires: pkgconfig(systemd) |
||||
BuildRequires: systemd |
||||
%{?systemd_ordering} |
||||
-%if 0%{?fedora} |
||||
Requires: python3-distro |
||||
-%endif |
||||
Requires: python3-dbus |
||||
Requires: python3-dnf >= %{dnf_lowest_compatible} |
||||
Requires: python3-hawkey >= %{hawkey_version} |
||||
diff --git a/doc/system-upgrade.rst b/doc/system-upgrade.rst |
||||
index 3110460..87b7319 100644 |
||||
--- a/doc/system-upgrade.rst |
||||
+++ b/doc/system-upgrade.rst |
||||
@@ -27,13 +27,15 @@ DNF system-upgrades plugin provides three commands: ``system-upgrade``, ``offlin |
||||
``offline-distrosync``. Only ``system-upgrade`` command requires increase of distribution major |
||||
version (``--releasever``) compared to installed version. |
||||
|
||||
-``dnf system-upgrade`` can be used to upgrade a Fedora system to a new major |
||||
-release. It replaces fedup (the old Fedora Upgrade tool). Before you proceed ensure that your system |
||||
+``dnf system-upgrade`` is a recommended way to upgrade a system to a new major release. |
||||
+It replaces fedup (the old Fedora Upgrade tool). Before you proceed ensure that your system |
||||
is fully upgraded (``dnf --refresh upgrade``). |
||||
|
||||
The ``system-upgrade`` command also performes additional actions necessary for the upgrade of the |
||||
system, for example an upgrade of groups and environments. |
||||
|
||||
+.. WARNING:: The ``system-upgrade`` command is not supported on the RHEL distribution. |
||||
+ |
||||
-------- |
||||
Synopsis |
||||
-------- |
||||
diff --git a/plugins/system_upgrade.py b/plugins/system_upgrade.py |
||||
index fee6762..0baf978 100644 |
||||
--- a/plugins/system_upgrade.py |
||||
+++ b/plugins/system_upgrade.py |
||||
@@ -20,6 +20,7 @@ |
||||
"""system_upgrade.py - DNF plugin to handle major-version system upgrades.""" |
||||
|
||||
from subprocess import call, Popen, check_output, CalledProcessError |
||||
+import distro |
||||
import json |
||||
import os |
||||
import os.path |
||||
@@ -451,6 +452,9 @@ class SystemUpgradeCommand(dnf.cli.Command): |
||||
|
||||
def configure_download(self): |
||||
if 'system-upgrade' == self.opts.command or 'fedup' == self.opts.command: |
||||
+ if distro.id() == 'rhel': |
||||
+ logger.warning(_('WARNING: this operation is not supported on the RHEL distribution. ' |
||||
+ 'Proceed at your own risk.')) |
||||
help_url = get_url_from_os_release() |
||||
if help_url: |
||||
msg = _('Additional information for System Upgrade: {}') |
||||
-- |
||||
2.38.1 |
||||
|
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
From eef927ac825c1a07082e10ffbf11e16ecbd7688c Mon Sep 17 00:00:00 2001 |
||||
From: =?UTF-8?q?Tarc=C3=ADsio=20Ladeia=20de=20Oliveira?= |
||||
<wyrquill@gmail.com> |
||||
Date: Thu, 20 Oct 2022 22:16:59 -0300 |
||||
Subject: [PATCH 1/2] [offline-upgrade] Add security filters (RhBug:1939975) |
||||
|
||||
Add support for security filter options that are available in the main |
||||
`dnf` commands, that is, `--advisory`, `--bugfix`, `--security`, and |
||||
`--enhancement`. |
||||
|
||||
= changelog = |
||||
msg: [offline-upgrade] Add support for security filters |
||||
type: bugfix |
||||
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1939975 |
||||
--- |
||||
plugins/system_upgrade.py | 3 +++ |
||||
1 file changed, 3 insertions(+) |
||||
|
||||
diff --git a/plugins/system_upgrade.py b/plugins/system_upgrade.py |
||||
index 0baf978..ef1de73 100644 |
||||
--- a/plugins/system_upgrade.py |
||||
+++ b/plugins/system_upgrade.py |
||||
@@ -467,6 +467,9 @@ class SystemUpgradeCommand(dnf.cli.Command): |
||||
logger.error(_("Operation aborted.")) |
||||
sys.exit(1) |
||||
check_release_ver(self.base.conf, target=self.opts.releasever) |
||||
+ elif 'offline-upgrade' == self.opts.command: |
||||
+ self.cli._populate_update_security_filter(self.opts) |
||||
+ |
||||
self.cli.demands.root_user = True |
||||
self.cli.demands.resolving = True |
||||
self.cli.demands.available_repos = True |
||||
-- |
||||
2.38.1 |
||||
|
||||
|
||||
From 7e5d3028caa743f3e5ac7bf921c3ec39a4d2c85b Mon Sep 17 00:00:00 2001 |
||||
From: =?UTF-8?q?Tarc=C3=ADsio=20Ladeia=20de=20Oliveira?= |
||||
<wyrquill@gmail.com> |
||||
Date: Thu, 20 Oct 2022 22:27:22 -0300 |
||||
Subject: [PATCH 2/2] Add myself as contributor in AUTHORS |
||||
|
||||
--- |
||||
AUTHORS | 1 + |
||||
1 file changed, 1 insertion(+) |
||||
|
||||
diff --git a/AUTHORS b/AUTHORS |
||||
index 352e195..f098cb6 100644 |
||||
--- a/AUTHORS |
||||
+++ b/AUTHORS |
||||
@@ -32,6 +32,7 @@ DNF-PLUGINS-CORE CONTRIBUTORS |
||||
Neal Gompa <ngompa13@gmail.com> |
||||
Paul Howarth <paul@city-fan.org> |
||||
Rickard Dybeck <r.dybeck@gmail.com> |
||||
+ Tarcísio Ladeia de Oliveira <wyrquill@gmail.com> |
||||
Tomas Babej <tomasbabej@gmail.com> |
||||
Vladan Kudlac <vladankudlac@gmail.com> |
||||
Wieland Hoffmann <themineo@gmail.com> |
||||
-- |
||||
2.38.1 |
||||
|
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
From e04aff1e65fb260912e7e0feeb201e17fa5abda4 Mon Sep 17 00:00:00 2001 |
||||
From: Jan Kolarik <jkolarik@redhat.com> |
||||
Date: Fri, 16 Dec 2022 05:55:19 +0000 |
||||
Subject: [PATCH] system-upgrade: Show warning always for a downstream |
||||
|
||||
As the distro package is not available in the BaseOS, the warning implementation will be shown always, but only in related downstreams. |
||||
|
||||
= changelog = |
||||
type: bugfix |
||||
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2152846 |
||||
--- |
||||
dnf-plugins-core.spec | 3 ++- |
||||
plugins/system_upgrade.py | 6 ++---- |
||||
2 files changed, 4 insertions(+), 5 deletions(-) |
||||
|
||||
diff --git a/dnf-plugins-core.spec b/dnf-plugins-core.spec |
||||
index 1ee87a1..4df6e44 100644 |
||||
--- a/dnf-plugins-core.spec |
||||
+++ b/dnf-plugins-core.spec |
||||
@@ -148,13 +148,14 @@ Summary: Core Plugins for DNF |
||||
%{?python_provide:%python_provide python3-%{name}} |
||||
BuildRequires: python3-dbus |
||||
BuildRequires: python3-devel |
||||
-BuildRequires: python3-distro |
||||
BuildRequires: python3-dnf >= %{dnf_lowest_compatible} |
||||
BuildRequires: python3-systemd |
||||
BuildRequires: pkgconfig(systemd) |
||||
BuildRequires: systemd |
||||
%{?systemd_ordering} |
||||
+%if 0%{?fedora} |
||||
Requires: python3-distro |
||||
+%endif |
||||
Requires: python3-dbus |
||||
Requires: python3-dnf >= %{dnf_lowest_compatible} |
||||
Requires: python3-hawkey >= %{hawkey_version} |
||||
diff --git a/plugins/system_upgrade.py b/plugins/system_upgrade.py |
||||
index ef1de73..4f7620f 100644 |
||||
--- a/plugins/system_upgrade.py |
||||
+++ b/plugins/system_upgrade.py |
||||
@@ -20,7 +20,6 @@ |
||||
"""system_upgrade.py - DNF plugin to handle major-version system upgrades.""" |
||||
|
||||
from subprocess import call, Popen, check_output, CalledProcessError |
||||
-import distro |
||||
import json |
||||
import os |
||||
import os.path |
||||
@@ -452,9 +451,8 @@ class SystemUpgradeCommand(dnf.cli.Command): |
||||
|
||||
def configure_download(self): |
||||
if 'system-upgrade' == self.opts.command or 'fedup' == self.opts.command: |
||||
- if distro.id() == 'rhel': |
||||
- logger.warning(_('WARNING: this operation is not supported on the RHEL distribution. ' |
||||
- 'Proceed at your own risk.')) |
||||
+ logger.warning(_('WARNING: this operation is not supported on the RHEL distribution. ' |
||||
+ 'Proceed at your own risk.')) |
||||
help_url = get_url_from_os_release() |
||||
if help_url: |
||||
msg = _('Additional information for System Upgrade: {}') |
||||
-- |
||||
2.39.0 |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
From f65bb02d8c6fb6569c3e1db43c3b0e9f2a0ab283 Mon Sep 17 00:00:00 2001 |
||||
From: Todd Lewis <todd_lewis@unc.edu> |
||||
Date: Wed, 16 Nov 2022 10:45:39 -0500 |
||||
Subject: [PATCH] Fix boot time derivation for systems with no rtc |
||||
|
||||
That addresses https://bugzilla.redhat.com/show_bug.cgi?id=2137935 |
||||
--- |
||||
plugins/needs_restarting.py | 24 +++++++++++++++++++++++- |
||||
1 file changed, 23 insertions(+), 1 deletion(-) |
||||
|
||||
diff --git a/plugins/needs_restarting.py b/plugins/needs_restarting.py |
||||
index 91dbe66..03831fa 100644 |
||||
--- a/plugins/needs_restarting.py |
||||
+++ b/plugins/needs_restarting.py |
||||
@@ -34,6 +34,7 @@ import functools |
||||
import os |
||||
import re |
||||
import stat |
||||
+import time |
||||
|
||||
|
||||
# For which package updates we should recommend a reboot |
||||
@@ -199,7 +200,28 @@ class ProcessStart(object): |
||||
|
||||
@staticmethod |
||||
def get_boot_time(): |
||||
- return int(os.stat('/proc/1').st_mtime) |
||||
+ """ |
||||
+ We have two sources from which to derive the boot time. These values vary |
||||
+ depending on containerization, existence of a Real Time Clock, etc. |
||||
+ For our purposes we want the latest derived value. |
||||
+ - st_mtime of /proc/1 |
||||
+ Reflects the time the first process was run after booting |
||||
+ This works for all known cases except machines without |
||||
+ a RTC - they awake at the start of the epoch. |
||||
+ - /proc/uptime |
||||
+ Seconds field of /proc/uptime subtracted from the current time |
||||
+ Works for machines without RTC iff the current time is reasonably correct. |
||||
+ Does not work on containers which share their kernel with the |
||||
+ host - there the host kernel uptime is returned |
||||
+ """ |
||||
+ |
||||
+ proc_1_boot_time = int(os.stat('/proc/1').st_mtime) |
||||
+ if os.path.isfile('/proc/uptime'): |
||||
+ with open('/proc/uptime', 'rb') as f: |
||||
+ uptime = f.readline().strip().split()[0].strip() |
||||
+ proc_uptime_boot_time = int(time.time() - float(uptime)) |
||||
+ return max(proc_1_boot_time, proc_uptime_boot_time) |
||||
+ return proc_1_boot_time |
||||
|
||||
@staticmethod |
||||
def get_sc_clk_tck(): |
||||
-- |
||||
2.40.1 |
||||
|
@ -0,0 +1,241 @@
@@ -0,0 +1,241 @@
|
||||
From d5f5883623ada37b4cec5909a1032c4bc3123a9a Mon Sep 17 00:00:00 2001 |
||||
From: Cameron Rodriguez <rod.cam2014+dev@gmail.com> |
||||
Date: Tue, 1 Nov 2022 02:25:52 -0400 |
||||
Subject: [PATCH] [system-upgrade] Add --poweroff option to reboot subcommand |
||||
|
||||
= changelog = |
||||
msg: Add --poweroff option to system-upgrade reboot |
||||
type: enhancement |
||||
--- |
||||
doc/system-upgrade.rst | 10 ++++++++++ |
||||
plugins/system_upgrade.py | 28 ++++++++++++++++++++++------ |
||||
tests/test_system_upgrade.py | 18 +++++++++++++++++- |
||||
3 files changed, 49 insertions(+), 7 deletions(-) |
||||
|
||||
diff --git a/doc/system-upgrade.rst b/doc/system-upgrade.rst |
||||
index 87b7319..6a7785b 100644 |
||||
--- a/doc/system-upgrade.rst |
||||
+++ b/doc/system-upgrade.rst |
||||
@@ -44,6 +44,8 @@ Synopsis |
||||
|
||||
``dnf system-upgrade reboot`` |
||||
|
||||
+``dnf system-upgrade reboot --poweroff`` |
||||
+ |
||||
``dnf system-upgrade clean`` |
||||
|
||||
``dnf system-upgrade log`` |
||||
@@ -54,6 +56,8 @@ Synopsis |
||||
|
||||
``dnf offline-upgrade reboot`` |
||||
|
||||
+``dnf offline-upgrade reboot --poweroff`` |
||||
+ |
||||
``dnf offline-upgrade clean`` |
||||
|
||||
``dnf offline-upgrade log`` |
||||
@@ -64,6 +68,8 @@ Synopsis |
||||
|
||||
``dnf offline-distrosync reboot`` |
||||
|
||||
+``dnf offline-distrosync reboot --poweroff`` |
||||
+ |
||||
``dnf offline-distrosync clean`` |
||||
|
||||
``dnf offline-distrosync log`` |
||||
@@ -116,6 +122,10 @@ Options |
||||
``--distro-sync``. If both are specified, the last option will be used. The option cannot be |
||||
used with the ``offline-distrosync`` command. |
||||
|
||||
+``--poweroff`` |
||||
+ When applied with the ``reboot`` subcommand, the system will power off after |
||||
+ upgrades are completed, instead of restarting. |
||||
+ |
||||
``--number`` |
||||
Applied with ``log`` subcommand will show the log specified by the number. |
||||
|
||||
diff --git a/plugins/system_upgrade.py b/plugins/system_upgrade.py |
||||
index 4f7620f..b99dd8a 100644 |
||||
--- a/plugins/system_upgrade.py |
||||
+++ b/plugins/system_upgrade.py |
||||
@@ -61,16 +61,19 @@ DOWNLOAD_FINISHED_MSG = _( # Translators: do not change "reboot" here |
||||
CANT_RESET_RELEASEVER = _( |
||||
"Sorry, you need to use 'download --releasever' instead of '--network'") |
||||
|
||||
-STATE_VERSION = 2 |
||||
+STATE_VERSION = 3 |
||||
|
||||
# --- Miscellaneous helper functions ------------------------------------------ |
||||
|
||||
|
||||
-def reboot(): |
||||
+def reboot(poweroff = False): |
||||
if os.getenv("DNF_SYSTEM_UPGRADE_NO_REBOOT", default=False): |
||||
logger.info(_("Reboot turned off, not rebooting.")) |
||||
else: |
||||
- Popen(["systemctl", "reboot"]) |
||||
+ if poweroff: |
||||
+ Popen(["systemctl", "poweroff"]) |
||||
+ else: |
||||
+ Popen(["systemctl", "reboot"]) |
||||
|
||||
|
||||
def get_url_from_os_release(): |
||||
@@ -183,6 +186,7 @@ class State(object): |
||||
upgrade_status = _prop("upgrade_status") |
||||
upgrade_command = _prop("upgrade_command") |
||||
distro_sync = _prop("distro_sync") |
||||
+ poweroff_after = _prop("poweroff_after") |
||||
enable_disable_repos = _prop("enable_disable_repos") |
||||
module_platform_id = _prop("module_platform_id") |
||||
|
||||
@@ -359,6 +363,10 @@ class SystemUpgradeCommand(dnf.cli.Command): |
||||
action='store_false', |
||||
help=_("keep installed packages if the new " |
||||
"release's version is older")) |
||||
+ parser.add_argument('--poweroff', dest='poweroff_after', |
||||
+ action='store_true', |
||||
+ help=_("power off system after the operation " |
||||
+ "is completed")) |
||||
parser.add_argument('tid', nargs=1, choices=CMDS, |
||||
metavar="[%s]" % "|".join(CMDS)) |
||||
parser.add_argument('--number', type=int, help=_('which logs to show')) |
||||
@@ -566,8 +574,13 @@ class SystemUpgradeCommand(dnf.cli.Command): |
||||
if not self.opts.tid[0] == "reboot": |
||||
return |
||||
|
||||
+ self.state.poweroff_after = self.opts.poweroff_after |
||||
+ |
||||
self.log_status(_("Rebooting to perform upgrade."), |
||||
REBOOT_REQUESTED_ID) |
||||
+ |
||||
+ # Explicit write since __exit__ doesn't seem to get called when rebooting |
||||
+ self.state.write() |
||||
reboot() |
||||
|
||||
def run_download(self): |
||||
@@ -686,12 +699,15 @@ class SystemUpgradeCommand(dnf.cli.Command): |
||||
self.log_status(_("Download finished."), DOWNLOAD_FINISHED_ID) |
||||
|
||||
def transaction_upgrade(self): |
||||
- Plymouth.message(_("Upgrade complete! Cleaning up and rebooting...")) |
||||
- self.log_status(_("Upgrade complete! Cleaning up and rebooting..."), |
||||
+ power_op = "powering off" if self.state.poweroff_after else "rebooting" |
||||
+ |
||||
+ Plymouth.message(_("Upgrade complete! Cleaning up and " + power_op + "...")) |
||||
+ self.log_status(_("Upgrade complete! Cleaning up and " + power_op + "..."), |
||||
UPGRADE_FINISHED_ID) |
||||
+ |
||||
self.run_clean() |
||||
if self.opts.tid[0] == "upgrade": |
||||
- reboot() |
||||
+ reboot(self.state.poweroff_after) |
||||
|
||||
|
||||
class OfflineUpgradeCommand(SystemUpgradeCommand): |
||||
diff --git a/tests/test_system_upgrade.py b/tests/test_system_upgrade.py |
||||
index 6ef4c21..769720d 100644 |
||||
--- a/tests/test_system_upgrade.py |
||||
+++ b/tests/test_system_upgrade.py |
||||
@@ -322,7 +322,7 @@ class RebootCheckCommandTestCase(CommandTestCaseBase): |
||||
def check_reboot(self, status='complete', lexists=False, command='system-upgrade', |
||||
state_command='system-upgrade'): |
||||
with patch('system_upgrade.os.path.lexists') as lexists_func: |
||||
- self.command.state.state_version = 2 |
||||
+ self.command.state.state_version = 3 |
||||
self.command.state.download_status = status |
||||
self.command.opts = mock.MagicMock() |
||||
self.command.opts.command = command |
||||
@@ -356,6 +356,7 @@ class RebootCheckCommandTestCase(CommandTestCaseBase): |
||||
@patch('system_upgrade.reboot') |
||||
def test_run_reboot(self, reboot, log_status, run_prepare): |
||||
self.command.opts = mock.MagicMock() |
||||
+ self.command.opts.poweroff_after = False |
||||
self.command.opts.tid = ["reboot"] |
||||
self.command.run_reboot() |
||||
run_prepare.assert_called_once_with() |
||||
@@ -363,6 +364,21 @@ class RebootCheckCommandTestCase(CommandTestCaseBase): |
||||
log_status.call_args[0][1]) |
||||
self.assertTrue(reboot.called) |
||||
|
||||
+ @patch('system_upgrade.SystemUpgradeCommand.run_prepare') |
||||
+ @patch('system_upgrade.SystemUpgradeCommand.log_status') |
||||
+ @patch('system_upgrade.reboot') |
||||
+ def test_reboot_poweroff_after(self, reboot, log_status, run_prepare): |
||||
+ self.command.opts = mock.MagicMock() |
||||
+ self.command.opts.tid = ["reboot"] |
||||
+ self.command.opts.poweroff_after = True |
||||
+ self.command.run_reboot() |
||||
+ run_prepare.assert_called_with() |
||||
+ self.assertEqual(system_upgrade.REBOOT_REQUESTED_ID, |
||||
+ log_status.call_args[0][1]) |
||||
+ self.assertTrue(self.command.state.poweroff_after) |
||||
+ self.assertTrue(reboot.called) |
||||
+ |
||||
+ |
||||
@patch('system_upgrade.SystemUpgradeCommand.run_prepare') |
||||
@patch('system_upgrade.SystemUpgradeCommand.log_status') |
||||
@patch('system_upgrade.reboot') |
||||
-- |
||||
2.40.1 |
||||
|
||||
|
||||
From 52aec32ef129874dc28fc93947e5d32c78baff0c Mon Sep 17 00:00:00 2001 |
||||
From: Cameron Rodriguez <rod.cam2014+dev@gmail.com> |
||||
Date: Tue, 1 Nov 2022 02:29:29 -0400 |
||||
Subject: [PATCH] Add Cameron Rodriguez to AUTHORS file |
||||
|
||||
--- |
||||
AUTHORS | 1 + |
||||
1 file changed, 1 insertion(+) |
||||
|
||||
diff --git a/AUTHORS b/AUTHORS |
||||
index f098cb6..a6102ec 100644 |
||||
--- a/AUTHORS |
||||
+++ b/AUTHORS |
||||
@@ -20,6 +20,7 @@ DNF-PLUGINS-CORE CONTRIBUTORS |
||||
Adam Salih <salih.max@gmail.com> |
||||
Alexander Todorov <atodorov@otb.bg> |
||||
Anders Blomdell <anders.blomdell@gmail.com> |
||||
+ Cameron Rodriguez <rod.cam2014+dev@gmail.com> |
||||
Cyril Jouve <jv.cyril@gmail.com> |
||||
David Michael <fedora.dm0@gmail.com> |
||||
François Rigault <francois.rigault@amadeus.com> |
||||
-- |
||||
2.40.1 |
||||
|
||||
|
||||
From dd081ebd4c46a79688f81ef639628189f8b78db3 Mon Sep 17 00:00:00 2001 |
||||
From: Cameron Rodriguez <rod.cam2014+dev@gmail.com> |
||||
Date: Sun, 4 Dec 2022 10:06:08 -0500 |
||||
Subject: [PATCH] [offline-upgrade] Fix strings for l10n |
||||
|
||||
--- |
||||
plugins/system_upgrade.py | 10 ++++++---- |
||||
1 file changed, 6 insertions(+), 4 deletions(-) |
||||
|
||||
diff --git a/plugins/system_upgrade.py b/plugins/system_upgrade.py |
||||
index b99dd8a..64195fd 100644 |
||||
--- a/plugins/system_upgrade.py |
||||
+++ b/plugins/system_upgrade.py |
||||
@@ -699,11 +699,13 @@ class SystemUpgradeCommand(dnf.cli.Command): |
||||
self.log_status(_("Download finished."), DOWNLOAD_FINISHED_ID) |
||||
|
||||
def transaction_upgrade(self): |
||||
- power_op = "powering off" if self.state.poweroff_after else "rebooting" |
||||
+ if self.state.poweroff_after: |
||||
+ upgrade_complete_msg = _("Upgrade complete! Cleaning up and powering off...") |
||||
+ else: |
||||
+ upgrade_complete_msg = _("Upgrade complete! Cleaning up and rebooting...") |
||||
|
||||
- Plymouth.message(_("Upgrade complete! Cleaning up and " + power_op + "...")) |
||||
- self.log_status(_("Upgrade complete! Cleaning up and " + power_op + "..."), |
||||
- UPGRADE_FINISHED_ID) |
||||
+ Plymouth.message(upgrade_complete_msg) |
||||
+ self.log_status(upgrade_complete_msg, UPGRADE_FINISHED_ID) |
||||
|
||||
self.run_clean() |
||||
if self.opts.tid[0] == "upgrade": |
||||
-- |
||||
2.40.1 |
||||
|
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
From 52c980f191993b61a42438a478d1e5629ea36c9f Mon Sep 17 00:00:00 2001 |
||||
From: Jaroslav Mracek <jmracek@redhat.com> |
||||
Date: Mon, 27 Mar 2023 10:24:59 +0200 |
||||
Subject: [PATCH] Documentation update for reposync (RhBug:2132383,2182004) |
||||
|
||||
The update describe the behavior when `-n` and `--download-metadata` |
||||
is used. |
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2132383 |
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2182004 |
||||
--- |
||||
doc/reposync.rst | 6 +++++- |
||||
1 file changed, 5 insertions(+), 1 deletion(-) |
||||
|
||||
diff --git a/doc/reposync.rst b/doc/reposync.rst |
||||
index 0df00b9..bbf714c 100644 |
||||
--- a/doc/reposync.rst |
||||
+++ b/doc/reposync.rst |
||||
@@ -46,7 +46,11 @@ All general DNF options are accepted. Namely, the ``--repoid`` option can be use |
||||
Delete local packages no longer present in repository. |
||||
|
||||
``--download-metadata`` |
||||
- Download all repository metadata. Downloaded copy is instantly usable as a repository, no need to run createrepo_c on it. |
||||
+ Download all repository metadata. Downloaded copy is instantly usable as a repository, no need to run createrepo_c |
||||
+ on it. When the option is used with `--newest-only`, only latest packages will be downloaded, but metadata will |
||||
+ still contain older packages. It might be useful to update metadata using `createrepo_c --update` to remove |
||||
+ the packages with missing RPM files from metadata. Otherwise, DNF ends with an error due to the missing files |
||||
+ whenever it tries to download older packages. |
||||
|
||||
``-g, --gpgcheck`` |
||||
Remove packages that fail GPG signature checking after downloading. Exit code is ``1`` if at least one package was removed. |
||||
-- |
||||
2.40.1 |
||||
|
@ -0,0 +1,88 @@
@@ -0,0 +1,88 @@
|
||||
From 169a79922d7cb8968ffd378b1c98959185ee417f Mon Sep 17 00:00:00 2001 |
||||
From: Andy Baugh <andy@troglodyne.net> |
||||
Date: Fri, 28 Apr 2023 10:52:16 -0500 |
||||
Subject: [PATCH] Add fix and test assertion for "no systemd unit exists for |
||||
pid" |
||||
|
||||
= changelog = |
||||
msg: Catch exception in needs-restarting.py when no systemd unit exists for pid |
||||
type: bugfix |
||||
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2122587 |
||||
related: None |
||||
--- |
||||
plugins/needs_restarting.py | 18 ++++++++++++++---- |
||||
tests/test_needs_restarting.py | 15 +++++++++++++-- |
||||
2 files changed, 27 insertions(+), 6 deletions(-) |
||||
|
||||
diff --git a/plugins/needs_restarting.py b/plugins/needs_restarting.py |
||||
index 03831fa..8dbc965 100644 |
||||
--- a/plugins/needs_restarting.py |
||||
+++ b/plugins/needs_restarting.py |
||||
@@ -138,10 +138,20 @@ def get_service_dbus(pid): |
||||
systemd_manager_object, |
||||
'org.freedesktop.systemd1.Manager' |
||||
) |
||||
- service_proxy = bus.get_object( |
||||
- 'org.freedesktop.systemd1', |
||||
- systemd_manager_interface.GetUnitByPID(pid) |
||||
- ) |
||||
+ service_proxy = None |
||||
+ try: |
||||
+ service_proxy = bus.get_object( |
||||
+ 'org.freedesktop.systemd1', |
||||
+ systemd_manager_interface.GetUnitByPID(pid) |
||||
+ ) |
||||
+ except dbus.DBusException as e: |
||||
+ # There is no unit for the pid. Usually error is 'NoUnitForPid'. |
||||
+ # Considering what we do at the bottom (just return if not service) |
||||
+ # Then there's really no reason to exit here on that exception. |
||||
+ # Log what's happened then move on. |
||||
+ msg = str(e) |
||||
+ logger.warning("Failed to get systemd unit for PID {}: {}".format(pid, msg)) |
||||
+ return |
||||
service_properties = dbus.Interface( |
||||
service_proxy, dbus_interface="org.freedesktop.DBus.Properties") |
||||
name = service_properties.Get( |
||||
diff --git a/tests/test_needs_restarting.py b/tests/test_needs_restarting.py |
||||
index 0ad70a5..7b629b4 100644 |
||||
--- a/tests/test_needs_restarting.py |
||||
+++ b/tests/test_needs_restarting.py |
||||
@@ -20,6 +20,8 @@ from __future__ import absolute_import |
||||
from __future__ import print_function |
||||
from __future__ import unicode_literals |
||||
|
||||
+from unittest.mock import patch, Mock |
||||
+import dbus |
||||
import needs_restarting |
||||
import tests.support |
||||
|
||||
@@ -29,8 +31,6 @@ MM_FILE = '7fc4e1168000-7fc4e1169000 rw-s 1096dd000 00:05 7749' \ |
||||
' /dev/dri/card0' |
||||
SO_FILE = '30efe06000-30efe07000 r--p 00006000 08:02 139936' \ |
||||
' /usr/lib64/libSM.so.6.0.1' |
||||
- |
||||
- |
||||
class NeedsRestartingTest(tests.support.TestCase): |
||||
def test_smap2opened_file(self): |
||||
func = needs_restarting.smap2opened_file |
||||
@@ -46,6 +46,17 @@ class NeedsRestartingTest(tests.support.TestCase): |
||||
self.assertTrue(ofile.deleted) |
||||
self.assertEqual(ofile.name, '/usr/lib64/libXfont.so.1.4.1;5408628d') |
||||
|
||||
+ def test_get_service_dbus_nounitforpid(self): |
||||
+ func = needs_restarting.get_service_dbus |
||||
+ # So, This is gonna look kinda screwy unless you are aware of what |
||||
+ # this proxies interface is actually doing. The GetUnitByPid function |
||||
+ # is normally "dynamically" defined by the get_dbus_method at runtime. |
||||
+ # As such there's no actual way to mock it out in any meaningful way |
||||
+ # without create=True. |
||||
+ with patch( "dbus.proxies.Interface.GetUnitByPID", create=True, side_effect=dbus.DBusException('org.freedesktop.systemd1.NoUnitForPID: PID 1234 does not belong to any loaded unit.') ), \ |
||||
+ patch( "dbus.SystemBus", return_value=Mock(spec=dbus.Bus) ), \ |
||||
+ patch( "dbus.bus.BusConnection.__new__", side_effect=dbus.DBusException("Never should hit this exception if mock above works")): |
||||
+ self.assertIsNone(func(1234)) |
||||
|
||||
class OpenedFileTest(tests.support.TestCase): |
||||
def test_presumed_name(self): |
||||
-- |
||||
2.40.1 |
||||
|
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
From 7475f8df6d903764eaf8baaa87ec7a3a1a4d888c Mon Sep 17 00:00:00 2001 |
||||
From: Jan Kolarik <jkolarik@redhat.com> |
||||
Date: Fri, 9 Jun 2023 11:57:33 +0000 |
||||
Subject: [PATCH] system-upgrade: Wait until the upgrade is done before |
||||
poweroff (RhBug:2211844) |
||||
|
||||
Add a systemd dependency to wait until upgrade service is finished before executing the poweroff when passing the `--poweroff` option in `system-upgrade` plugin. |
||||
|
||||
= changelog = |
||||
msg: Fix systemd dependencies when using --poweroff option in system-upgrade plugin |
||||
type: bugfix |
||||
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2211844 |
||||
--- |
||||
etc/systemd/dnf-system-upgrade.service | 2 +- |
||||
1 file changed, 1 insertion(+), 1 deletion(-) |
||||
|
||||
diff --git a/etc/systemd/dnf-system-upgrade.service b/etc/systemd/dnf-system-upgrade.service |
||||
index 2d23cfe..3e15920 100644 |
||||
--- a/etc/systemd/dnf-system-upgrade.service |
||||
+++ b/etc/systemd/dnf-system-upgrade.service |
||||
@@ -6,7 +6,7 @@ Documentation=http://www.freedesktop.org/wiki/Software/systemd/SystemUpdates |
||||
DefaultDependencies=no |
||||
Requires=sysinit.target |
||||
After=sysinit.target systemd-journald.socket system-update-pre.target |
||||
-Before=shutdown.target system-update.target |
||||
+Before=poweroff.target reboot.target shutdown.target system-update.target |
||||
OnFailure=dnf-system-upgrade-cleanup.service |
||||
|
||||
[Service] |
||||
-- |
||||
2.40.1 |
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue