Bug 1014330

Summary: Ineffective scriptlets for updating rhnplugin.conf
Product: Red Hat Enterprise Linux 6 Reporter: John T. Rose <inode0>
Component: yum-rhn-pluginAssignee: Michael Mráka <mmraka>
Status: CLOSED CANTFIX QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: akrherz, cperry, jhutar
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-09 07:29:12 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:
Bug Depends On:    
Bug Blocks: 1023565, 1056252    

Description John T. Rose 2013-10-01 18:09:28 UTC
Description of problem:

The SPEC file tags rhnplugin.conf as noreplace but there are pre and post install scriptlets that seem to be attempting to update this file during upgrades. As far as I can tell these scriptlets just create and remove a file in /var/tmp.

preinstall scriptlet (using /bin/sh):
# 682820 - re-enable yum-rhn-plugin after package upgrade if the system is already registered
export pluginconf='/etc/yum/pluginconf.d/rhnplugin.conf'
if [ $1 -gt 1 ] && [ -f /etc/sysconfig/rhn/systemid ] && [ -f "$pluginconf" ]; then
    if grep -q '^[[:space:]]*enabled[[:space:]]*=[[:space:]]*1[[:space:]]*$' \
       "$pluginconf"; then
        touch /var/tmp/enable-yum-rhn-plugin
    fi
fi

postinstall scriptlet (using /bin/sh):
# 682820 - re-enable yum-rhn-plugin after package upgrade if the system is already registered
export pluginconf='/etc/yum/pluginconf.d/rhnplugin.conf'
if [ $1 -gt 1 ] && [ -f "$pluginconf" ] && [ -f "/var/tmp/enable-yum-rhn-plugin" ]; then
    sed -i '/\[main]/,/^$/{/enabled/s/0/1/}' "$pluginconf"
    rm -f /var/tmp/enable-yum-rhn-plugin
fi

This has the effect of leaving the new rhnplugin.conf file in rhnplugin.conf.rpmnew with RHN disabled in it. Doesn't seem to be ideal.

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

yum-rhn-plugin-0.9.1-49.el6.noarch

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:

rhnplugin.conf is never updated

Expected results:

Would be nice to have this file updated when it hasn't been changed by the user (in this case registration is changing it but that really shouldn't prevent further updates)

Additional info:

Comment 2 RHEL Program Management 2013-10-14 01:50:05 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 3 John T. Rose 2013-10-15 14:38:55 UTC
So, while I can open a support case for this that seems a rather silly waste of my time. My only goal reporting it here was to help you make your product better.

Why is Comment 1 hidden? Any reason I shouldn't be able to see whatever discussion there was for this bug report? It doesn't seem overly sensitive on the surface.

If it should be fixed and can't be in 6.4 or in 6.5 then why not just work it into whatever schedule works on your end without me needing to open another copy of this report in yet another tracking system?

Comment 4 Clifford Perry 2014-02-03 14:45:08 UTC
(In reply to John T. Rose from comment #3)
> So, while I can open a support case for this that seems a rather silly waste
> of my time. My only goal reporting it here was to help you make your product
> better.
> 
> Why is Comment 1 hidden? Any reason I shouldn't be able to see whatever
> discussion there was for this bug report? It doesn't seem overly sensitive
> on the surface.
> 
> If it should be fixed and can't be in 6.4 or in 6.5 then why not just work
> it into whatever schedule works on your end without me needing to open
> another copy of this report in yet another tracking system?


John, it is an automated script used for parsing the large quantity of RHEL bugs. Comment #1 was again an automated, private comment, so employees knew it set the proposed flags for a specific release cycle. 

I'll consider this for RHEL 6.6 cycles.  

Regards,
Cliff

Comment 6 Michael Mráka 2014-06-09 07:29:12 UTC
> Would be nice to have this file updated when it hasn't been changed by the
> user (in this case registration is changing it but that really shouldn't
> prevent further updates)

Unfortunately the the fact that config file has been updated by registration matters. So when updating rpm package this change is detected and leads to creation of rpmnew. There's no way to prevent this. Pre/post install scripts has no effect on this behaviour.

Comment 7 John T. Rose 2014-06-09 20:37:28 UTC
There are two ways to fix this IMO.

(1) Remove the useless scriptlets entirely.

(2) Change the postinstall scriptlet to modify rhnplugin.conf.rpmnew instead so that it is in sync with the state of the running system (i.e., has RHN enabled).