Enhancement: Allow update notifications to be send even when no updates are needed
kevin-j-smith opened this issue · 1 comments
kevin-j-smith commented
For updatesCheck where:
pups = self.refreshUpdates()
gups = self.refreshGroupUpdates()
# If neither have updates, we can just exit.
if not (pups or gups):
sys.exit(0)
Go ahead and emit message and release the lock even when no updates are available. Possible to give emitter flag to allow this to be configurable.
pups = self.refreshUpdates()
gups = self.refreshGroupUpdates()
# If neither have updates, we can just exit.
if not (pups or gups):
self.emitMessages()
self.releaseLocks()
sys.exit(0)
class UpdateEmitter(object):
def sendMessages(self):
"""Send the messages that have been stored. This should be
overridden by inheriting classes to emit the messages
according to their individual methods.
"""
if self.opts.emit_when_already_updated and not self.output:
self.output.append("Yum Cron Update ran successfully and 0 packages needing updated")
# Convert any byte strings to unicode objects now (so that we avoid
# implicit conversions with the "ascii" codec later when join()-ing the
# strings, leading to tracebacks).
self.output = [x.decode('utf-8') if isinstance(x, str) else x
for x in self.output]
This will allow configurability and notification even when 0 packages need updating.
lukash commented
As I've said in #120 : yum has been superseded by https://github.com/rpm-software-management/dnf, so any effort in this direction should be done over there. The development of yum has stopped.