From 7c3cf97b85818e2dca86a7359db819b058aaaf74 Mon Sep 17 00:00:00 2001 From: derickdiaz Date: Thu, 19 Oct 2023 05:21:23 -0500 Subject: [PATCH] Added 'send_error_messages' Boolean Option and updated man docs Added option 'send_error_messages' Fixed Option String List Changed option to Boolean --- dnf/automatic/main.py | 8 +++----- doc/automatic.rst | 5 +++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dnf/automatic/main.py b/dnf/automatic/main.py index 96800dbdc7..c27a75268d 100644 --- a/dnf/automatic/main.py +++ b/dnf/automatic/main.py @@ -230,6 +230,7 @@ def __init__(self): libdnf.conf.VectorString(['email', 'stdio']))) self.add_option('output_width', libdnf.conf.OptionNumberInt32(80)) self.add_option('system_name', libdnf.conf.OptionString(socket.gethostname())) + self.add_option('send_error_messages', libdnf.conf.OptionBool(False)) def gpgsigcheck(base, pkgs): @@ -367,13 +368,10 @@ def main(args): (conf.commands.reboot == 'when-needed' and base.reboot_needed())): exit_code = os.waitstatus_to_exitcode(os.system(conf.commands.reboot_command)) if exit_code != 0: - logger.error('Error: reboot command returned nonzero exit code: %d', exit_code) - emitters.notify_error('Error: reboot command returned nonzero exit code: %d', exit_code) - emitters.commit() - return 1 + raise dnf.exceptions.Error('reboot command returned nonzero exit code: %d', exit_code) except dnf.exceptions.Error as exc: logger.error(_('Error: %s'), ucd(exc)) - if conf.emitters != None: + if conf.emitters.send_error_messages and emitters != None: emitters.notify_error(_('Error: %s') % str(exc)) emitters.commit() return 1 diff --git a/doc/automatic.rst b/doc/automatic.rst index 2566c9d897..fc3a1ccc28 100644 --- a/doc/automatic.rst +++ b/doc/automatic.rst @@ -120,6 +120,11 @@ Choosing how the results should be reported. How the system is called in the reports. +``send_error_messages`` + boolean, default: False + + Invokes emitters when an errors occurs + --------------------- ``[command]`` section ---------------------