Bug 1330670

Summary: [PATCH] Have yum-cron provide hostname for from email
Product: Red Hat Enterprise Linux 7 Reporter: Pat Riehecky <riehecky>
Component: yumAssignee: Valentina Mukhamedzhanova <vmukhame>
Status: CLOSED ERRATA QA Contact: Karel Srot <ksrot>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.2CC: admiller, extras-orphan, extras-qa, james.antill, rdieter, vmukhame
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: yum-3.4.3-145.el7 Doc Type: Enhancement
Doc Text:
Feature: This is an enhancement for yum-cron config files. If the domain part of the email address in "email_from" config option is set to 'localhost', it will be replaced with the value of "system_name" config option. Reason: System administrators with many systems need a way to determine which system the email is coming from. Result: With default values of config options, the emails from yum-cron will be coming from the address that contains a specific system name instead of 'localhost'.
Story Points: ---
Clone Of: 1121189 Environment:
Last Closed: 2016-11-04 05:32:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pat Riehecky 2016-04-26 17:06:56 UTC
+++ This bug was initially created as a clone of Bug #1121189 +++

Description of problem: It would be nice if yum-cron could fill out the 'from' section a bit more elegantly when left to the defaults.  The program already locates the hostname, so I thought it might be nice if it used that for 'from' if left at the defaults.


Version-Release number of selected component (if applicable):yum-cron-3.4.3-152.fc21.noarch.rpm


How reproducible:100%


Steps to Reproduce:
1.enable sending email
2.note it comes from root@localhost
3.

Actual results:
From: root@localhost

Expected results:
something more specific

Additional info:
Attached patch resolves.

--- Additional comment from Rex Dieter on 2014-10-31 14:17:32 EDT ---

triaging to yum component

--- Additional comment from Jaroslav Reznik on 2015-03-03 11:08:11 EST ---

This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 2 Valentina Mukhamedzhanova 2016-06-03 11:38:24 UTC
Thanks for the patch!

Comment 5 Karel Srot 2016-07-04 11:19:06 UTC
The proposed patch does only string replace

+        # transform 'localhost' into a more specific descriptor
+        email_from = self.opts.email_from.replace('localhost', self.opts.system_name)

I think it should be improved so it does the substitution only in case the opts.email_from matches exactly the default value (localhost). It is not very likely that my customized email_from would be something like "mylocalhost" but if it were, proposed change would not alter the default value but my customized value. Moreover, I would propose to extend the configuration file with a comment mentioning that such substitution is happening.

Comment 6 Karel Srot 2016-07-04 11:22:42 UTC
(In reply to Karel Srot from comment #5)
> Moreover, I would propose to extend the
> configuration file with a comment mentioning that such substitution is
> happening.

Ignore this part, I can see that the config file has been updated.

Comment 8 Valentina Mukhamedzhanova 2016-07-18 13:22:35 UTC
Done.

Comment 11 errata-xmlrpc 2016-11-04 05:32:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2397.html