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 ---------------------