Bug 788972

Summary: Script /etc/cron.daily/rhn-ssl-cert-check FAILs if more than one traceback mails are set
Product: Red Hat Satellite 5 Reporter: Dimitar Yordanov <dyordano>
Component: ServerAssignee: Jan Pazdziora (Red Hat) <jpazdziora>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Korbel <mkorbel>
Severity: medium Docs Contact:
Priority: medium    
Version: 541CC: cperry, jpazdziora, mkorbel, mminar, xdmoon
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-ssl-cert-check-2.1-2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-21 09:17:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 818987    

Description Dimitar Yordanov 2012-02-09 12:55:15 UTC
Description of problem:
Script  /etc/cron.daily/rhn-ssl-cert-check  FAILs if more than one traceback mails are set in /etc/rhn/rhn.conf

Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. In /etc/rhn/rhn.conf set more than one traceback e-mails.
     traceback_mail = root@localhost, abc
2. Execute:
     /etc/cron.daily/rhn-ssl-cert-check
  

Actual results:
sed: -e expression #2, char 81: extra characters after command

Expected results:
No output, no errors.

Additional info:

Comment 1 Dimitar Yordanov 2012-02-09 13:06:30 UTC
The problem is that the code used for processing the output form 
     $(spacewalk-cfg-get traceback_mail)
is the same as in Sat[5.3|5.2] but there two main differences:
  1. then the approach for obtaining traceback_mail list was different back then.
  2. In 5.3 and 5.2  /bin/mail was used for sending the mail. In 5.4 is used sendmail.

Proposed Fix:

file: /etc/cron.daily/rhn-ssl-cert-check

if [ -z "$ADMIN" ]; then
    #ADMIN=$(spacewalk-cfg-get traceback_mail)
     ADMIN=$( spacewalk-cfg-get traceback_mail | tr '\n' ',')
    # Remove the last comma
     ADMIN=${ADMIN/%,/}
    # Replace commas with spaces
    #ADMIN=${ADMIN//,/ }
    # Trim leading spaces
    shopt -s extglob
    ADMIN=${ADMIN/#+( )/}
fi


How the fix was tested:
Sat 5.4.1 RHEL6 and RHEL5

In file: /etc/cron.daily/rhn-ssl-cert-check
Set : EXPIRATION=${EXPIRATION:-10000}

In file /etc/rhn/rhn.conf
Set :traceback_mail = root@localhost, dyordano

Execute:
  /etc/cron.daily/rhn-ssl-cert-check

Result:
 Two mails received.

Comment 2 Jan Pazdziora (Red Hat) 2012-02-15 09:07:14 UTC
Would the following patch help?

--- rhn-ssl-cert-check 2010-06-04 14:19:03.000000000 +0200
+++ rhn-ssl-cert-check.new 2012-02-15 09:55:24.000000000 +0100
@@ -33,11 +33,6 @@

 if [ -z "$ADMIN" ]; then
     ADMIN=$(spacewalk-cfg-get traceback_mail)
-    # Replace commas with spaces
-    ADMIN=${ADMIN//,/ }
-    # Trim leading spaces
-    shopt -s extglob
-    ADMIN=${ADMIN/#+( )/}
 fi

 if [ -z "$ADMIN" ]; then

Comment 5 Jan Pazdziora (Red Hat) 2012-06-07 13:59:50 UTC
Fixed in Spacewalk master, 302f3073eec15286963a3b862519a84cb460af4a.

Comment 12 Clifford Perry 2012-09-21 09:17:51 UTC
This issue is resolved with the release of RHN Satellite 5.5. 

As of September 20th 2012, RHN Satellite 5.5 has been generally available. 

Release Notes and other 5.5 documentation can be found here:

 https://access.redhat.com/knowledge/docs/Red_Hat_Network_Satellite/

The associated Errata for the 5.5 release are:

5.5 Satellite GA Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1296.html

5.5 Upgrade Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1298.html

5.5 RHN Proxy GA Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1297.html

5.5 RHN Tools GA Errata
 - http://rhn.redhat.com/errata/RHEA-2012-1299.html

Regards,
Clifford
- Engineering Manager, Satellite