Bug 830631 - [Patch] Disables yum-rhn-plugin a little bit safer in %post in client entitlement rpms' spec template
[Patch] Disables yum-rhn-plugin a little bit safer in %post in client entitle...
Product: Red Hat Update Infrastructure for Cloud Providers
Classification: Red Hat
Component: RHUA (Show other bugs)
Unspecified Unspecified
high Severity unspecified
: ---
: 2.1.3
Assigned To: John Matthews
: Triaged
Depends On:
  Show dependency treegraph
Reported: 2012-06-10 23:55 EDT by Satoru SATOH
Modified: 2013-12-17 15:08 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-12-17 15:08:48 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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-10 23:55 EDT, Satoru SATOH
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1854 normal SHIPPED_LIVE Red Hat Update Infrastructure 2.1.3 bug fix update 2013-12-17 20:07:53 EST

  None (edit)
Description Satoru SATOH 2012-06-10 23:55:37 EDT
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):
Comment 1 Satoru SATOH 2012-06-11 01:27:29 EDT
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 13:12:19 EDT
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 10:33:03 EST
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 10:35:13 EST
Comment 9 Vitaly Kuznetsov 2013-11-19 03:58:29 EST

# 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 || :

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 15:08:48 EST
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.


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