Bug 830631

Summary: [Patch] Disables yum-rhn-plugin a little bit safer in %post in client entitlement rpms' spec template
Product: Red Hat Update Infrastructure for Cloud Providers Reporter: Satoru SATOH <ssato>
Component: RHUAAssignee: John Matthews <jmatthew>
Status: CLOSED ERRATA QA Contact: mkovacik
Severity: unspecified Docs Contact:
Priority: high    
Version: 2.0.3CC: cbillett, ipanova, jmatthew, kbidarka, sclewis, sghai, tsanders, vkuznets, whayutin
Target Milestone: ---Keywords: Triaged
Target Release: 2.1.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-17 20:08:48 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:
Attachments:
Description Flags
Disables yum-rhn-plugin a little bit safer in %post in client entitlement rpms' spec template none

Description Satoru SATOH 2012-06-11 03:55:37 UTC
Created attachment 590810 [details]
Disables yum-rhn-plugin a little bit safer in %post in client entitlement rpms' spec template

Description of problem:


Currently, client entitlement rpms disabling yum-rhn-plugin in its %post w/
using sed and mv combination anytime but it should become safer like the
patch attached, IMHO.



Version-Release number of selected component (if applicable):
rh-rhui-tools-2.0.64-1.el6_2

Comment 1 Satoru SATOH 2012-06-11 05:27:29 UTC
The patch I posted may also 'fix' the following rpmlint warning
and error, I guess:

rhui-client-entitlement-rhui-2.0.noarch: W: dangerous-command-in-%post mv
rhui-client-entitlement-rhui-2.0.noarch: E: use-tmp-in-%post

Comment 2 wes hayutin 2013-07-24 17:12:19 UTC
I think this has been fixed at least in the rh-amazon-rhui-client.
Fix can be pulled from there.

Its not fixed in the general rhui code afaik.

Comment 6 Ina Panova 2013-11-06 15:33:03 UTC
Hi guys, just noticed that using sed leads to the situation that the file date time will be anyway changed regardless it was modified or not. So every time when a client conf rpm will be installed, rhnplugin.conf will be changed even if no changes in fact have been made. And this could be a bit confusing. So maybe it will be better to use something like :

grep -iP "enabled = (0|false|off)" rhnplugin.conf || sed ...

Comment 8 John Matthews 2013-11-18 15:35:13 UTC
RHEL-6.4-RHUI-2.1.3-20131118.1-Server-x86_64-DVD1.iso

Comment 9 Vitaly Kuznetsov 2013-11-19 08:58:29 UTC
Verified,

# rpm -q --scripts rhel5c1
postinstall scriptlet (using /bin/sh):
if [ "$1" = "1" ]; then  # 'install', not 'upgrade'
  # Disable RHN plugin
  if [ -f /etc/yum/pluginconf.d/rhnplugin.conf ]; then
   grep -iP "enabled = (0|false|off)"  /etc/yum/pluginconf.d/rhnplugin.conf  || sed -i.save -e 's/^enabled.*/enabled = 0/g' /etc/yum/pluginconf.d/rhnplugin.conf || :
  fi
fi

The small issue here is: 'grep -iP "enabled = (0|false|off)"' prints matching line to stdout, so during package install we can see:

# rpm -i rhel5c1-2.0-1.noarch.rpm 
enabled = 0

I would suggest adding '-q' switch to this grep to avoid any output.

Comment 11 errata-xmlrpc 2013-12-17 20:08:48 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.

http://rhn.redhat.com/errata/RHBA-2013-1854.html