diff --git a/dnf/automatic/main.py b/dnf/automatic/main.py index 96800dbdc7..965bcb46b8 100644 --- a/dnf/automatic/main.py +++ b/dnf/automatic/main.py @@ -230,6 +230,9 @@ 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.OptionString( + libdnf.conf.VectorString(['yes', 'no']) + )) def gpgsigcheck(base, pkgs): @@ -367,13 +370,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..3abdb1a594 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`` + list, default: ``yes, no`` + + Invokes emitters when an errors occurs + --------------------- ``[command]`` section --------------------- diff --git a/etc/dnf/automatic.conf b/etc/dnf/automatic.conf index f60f75b9e9..fa9c9b4e0d 100644 --- a/etc/dnf/automatic.conf +++ b/etc/dnf/automatic.conf @@ -47,6 +47,7 @@ reboot_command = "shutdown -r +5 'Rebooting after applying package updates'" # If emit_via is None or left blank, no messages will be sent. emit_via = stdio +send_error_messages = "no" [email] # The address to send email messages from.