Bug 953345
| Summary: | [PATCH] post scriptlet in RHUI client config rpms should not warn even if /etc/yum/pluginconf.d/rhnplugin.conf does not exists (as yum-rhn-plugin is not installed) | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Update Infrastructure for Cloud Providers | Reporter: | Satoru SATOH <ssato> | ||||
| Component: | Tools | Assignee: | James Slagle <jslagle> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Radek Bíba <rbiba> | ||||
| Severity: | low | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 2.1.1 | CC: | bizhang, bkearney, cduryee, igulina, pcreech, tsanders, whayutin | ||||
| Target Milestone: | --- | ||||||
| Target Release: | 3.0.0 | ||||||
| Hardware: | All | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2017-03-01 22:07:52 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
Satoru SATOH
2013-04-18 01:46:06 UTC
Created attachment 737104 [details]
The console log during installation of RHUI client config RPM
This is the console log of RHEL 6.4 x86_64 guest during installation of
RHUI client config RPM named rhel-6-config built w/
rh-rhui-tools-2.1.17-1.el6_3.noarch.
yum-rhn-plugin is not installed in this guest.
Sorry that I didn't think cases of rhui client config updates carefully. This should be better than previous one: [root@rhua ~]# diff -u /etc/rhui/templates/rh-client-config.spec.save /etc/rhui/templates/rh-client-config.spec --- /etc/rhui/templates/rh-client-config.spec.save 2013-04-18 10:32:13.323003015 +0900 +++ /etc/rhui/templates/rh-client-config.spec 2013-04-18 21:24:35.201003004 +0900 @@ -54,9 +54,11 @@ %post -# Disable RHN plugin -sed -e 's/^enabled.*/enabled = 0/g' /etc/yum/pluginconf.d/rhnplugin.conf > /tmp/rhnplugin.conf -mv /tmp/rhnplugin.conf /etc/yum/pluginconf.d/ +if [ $1 = 1 ]; then # 1: install (http://fedoraproject.org/wiki/Packaging:ScriptletSnippets) + # Disable RHN plugin if yum-rhn-plugin is installed: + f=/etc/yum/pluginconf.d/rhnplugin.conf + test -f $f && sed -i.rhuisave -e 's/^enabled.*/enabled = 0/g' $f || : +fi %clean [root@rhua ~]# Currently, I can't check if it's applicable to RHUI3 because of BZ1308349 It appears code exists now in the specfile template to handle this case. This must have been fixed a long time ago, and even in RHUI 2. Anyway, here's how the scriptlet looks now:
%post
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
So, as one can expect, the actual tweaking of 'enabled' is only performed if the rhnplugin.conf file exists. In practice:
# yum remove yum-rhn-plugin-2.0.1-6.el7.noarch
...
Complete!
# ls /etc/yum/pluginconf.d/rhnplugin.conf
ls: cannot access /etc/yum/pluginconf.d/rhnplugin.conf: No such file or directory
# rpm -ivh /tmp/rhui-7-1.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:rhui-7-1 ################################# [100%]
#
The tweaking is performed if the file exists and the plugin is enabled:
# ls /etc/yum/pluginconf.d/rhnplugin.conf
/etc/yum/pluginconf.d/rhnplugin.conf
# grep ^enabled /etc/yum/pluginconf.d/rhnplugin.conf
enabled = 1
# rpm -ihv /tmp/rhui-7-1.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:rhui-7-1 ################################# [100%]
# grep ^enabled /etc/yum/pluginconf.d/rhnplugin.conf
enabled = 0
# diff /etc/yum/pluginconf.d/rhnplugin.conf{.save,}
2c2
< enabled = 1
---
> enabled = 0
If the plugin is disabled to begin with, 'enabled = 0' is printed after the config RPM is installed, but that's another bug (already filed).
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. https://access.redhat.com/errata/RHBA-2017:0367 |