Bug 830631 - [Patch] Disables yum-rhn-plugin a little bit safer in %post in client entitlement rpms' spec template
Summary: [Patch] Disables yum-rhn-plugin a little bit safer in %post in client entitle...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Update Infrastructure for Cloud Providers
Classification: Red Hat
Component: RHUA
Version: 2.0.3
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: ---
: 2.1.3
Assignee: John Matthews
QA Contact: mkovacik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-11 03:55 UTC by Satoru SATOH
Modified: 2013-12-17 20:08 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-12-17 20:08:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Disables yum-rhn-plugin a little bit safer in %post in client entitlement rpms' spec template (1.10 KB, patch)
2012-06-11 03:55 UTC, Satoru SATOH
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1854 0 normal SHIPPED_LIVE Red Hat Update Infrastructure 2.1.3 bug fix update 2013-12-18 01:07:53 UTC

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


Note You need to log in before you can comment on or make changes to this bug.