Bug 712047

Summary: yum prints non-error messages when running in quiet mode
Product: Red Hat Enterprise Linux 6 Reporter: Jan Stodola <jstodola>
Component: subscription-managerAssignee: Chris Duryee <cduryee>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: cduryee
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: 2011-12-06 17:15:11 UTC Type: ---
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: 682238, 691780, 743047    

Description Jan Stodola 2011-06-09 11:10:24 UTC
Description of problem:
When running yum with '--quiet' option, there are messages printed on terminal:

[root@rtt6 ~]# yum -y --quiet install zsh
duration: 602(ms)
installing: 72.pem
Installed products updated.
[root@rtt6 ~]# echo $?
0
[root@rtt6 ~]#

Version-Release number of selected component (if applicable):
RHEL 6.1 GA
yum-3.2.29-17.el6

How reproducible:
always

Steps to Reproduce:
1. install RHEL 6.1, default package set
2. configure yum repository:
[root@rtt6 ~]# cat /etc/yum.repos.d/rhel.repo 
[rhel]
name=rhel
baseurl=http://<server_name>/released/RHEL-6/6.1/Server/s390x/os/
gpgcheck=0
3. run 'yum -y --quiet install zsh'
  
Actual results:
[root@rtt6 ~]# yum -y --quiet install zsh
duration: 602(ms)
installing: 72.pem
Installed products updated.
[root@rtt6 ~]#

Expected results:
[root@rtt6 ~]# yum -y --quiet install zsh
[root@rtt6 ~]#

Comment 1 seth vidal 2011-06-09 13:16:31 UTC
this is either coming from the rhn plugin or the entitlement plugin.

Comment 2 Miroslav Suchý 2011-06-09 15:10:54 UTC
This is coming from subscription-manager

Comment 3 Chris Duryee 2011-08-11 16:49:04 UTC
fixed in 303423da4cb265649ab9dbd4c790c8aa2f628d0a, master 0.95.6+

Comment 5 John Sefler 2011-09-08 22:00:26 UTC
Although reported against RHEL61, I am verifying the fix is included in the subscription-manager package version that is targeted for release in RHEL62 as indicated by the errata in comment 4

Verifying Version...
[root@jsefler-stage-6server ~]# rpm -q subscription-manager
subscription-manager-0.96.7-1.el6.x86_64

Using the stage test environment and credentials for stage_test_2, I have registered a system and subscribed to (Red Hat Enterprise Linux Server) and a pool (High-Availability (8 sockets)) for which I do not have a product cert (83.pem) installed...


[root@jsefler-stage-6server ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux High Availability (for RHEL Server)
Status:             	Not Installed            
Expires:            	06/13/2012               
SerialNumber:       	3204589806487586327      
ContractNumber:     	2394350                  
AccountNumber:      	1465503                  


ProductName:        	Red Hat Enterprise Linux Server
Status:             	Subscribed               
Expires:            	06/12/2012               
SerialNumber:       	5920704196687448827      
ContractNumber:     	2394347                  
AccountNumber:      	1465503                  

[root@jsefler-stage-6server ~]# ls /etc/pki/product
69.pem

^^^ NOTICE THERE IS NOT A PRODUCT CERT INSTALLED FOR HIGH AVAILABLITY.
NOW LET'S QUIETLY YUM INSTALL SOME PACKAGES INCLUDING ONE FROM THE HA REPO...

[root@jsefler-stage-6server ~]# yum list zsh ricci
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating certificate-based repositories.
rhel-6-server-rpms                                 | 2.4 kB     00:00     
rhel-ha-for-rhel-6-server-rpms                     | 2.7 kB     00:00     
Available Packages
ricci.x86_64       0.16.2-35.el6_1.1        rhel-ha-for-rhel-6-server-rpms
zsh.x86_64         4.3.10-4.1.el6           rhel-6-server-rpms   

[root@jsefler-stage-6server ~]# yum -y --quiet install zsh ricci
Installed products updated.
[root@jsefler-stage-6server ~]# ls /etc/pki/product
69.pem  83.pem

^^^ Notice that product 83.pem was indeed installed, and...

^^^ VERIFIED THAT "duration: 602(ms)" and "installing: 83.pem" were indeed removed.  However, "Installed products updated." is still getting printed despite the --quiet option passed to yum.  THEREFORE moving back to NEW/FailedQA.


This defect is more than just removing the print statements from the subscription-manager/product-id plugins.  It's about these plugins acknowledging the yum --quiet option and then deciding when to print "Installed products updated." to stdout.

Comment 6 Chris Duryee 2011-09-09 15:02:33 UTC
4a43f72 master 0.96.10+

Comment 7 Chris Duryee 2011-09-09 15:08:26 UTC
There were two issues for this bug. The first was that there were "print" statements in the code for the duration time, which weren't being handled via the yum logger. These were cleaned up in the first commit.

The second issue was that some calls were using conduit.error() for info messages instead of conduit.info(), so the --quiet option wasn't silencing what's essentially an informational message.

Comment 8 John Sefler 2011-09-10 02:27:08 UTC
Verifying Version...
[root@jsefler-stage-6server ~]# rpm -q subscription-manager
subscription-manager-0.96.9-1.git.10.adab5e3.el6.x86_64
[root@jsefler-stage-6server ~]# rpm -q python-rhsm
python-rhsm-0.96.11-1.git.8.7061b8a.el6.noarch

First let's yum install without --quiet and look for the "Installed products updated." info message coming from the subscription-manager plugin.

[root@jsefler-stage-6server ~]# ls /etc/pki/product/
69.pem
[root@jsefler-stage-6server ~]# yum -y install zsh ricci
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating certificate-based repositories.
rhel-6-server-rpms                                       | 2.4 kB     00:00     
rhel-ha-for-rhel-6-server-rpms                           | 2.7 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ricci.x86_64 0:0.16.2-35.el6_1.1 will be installed
---> Package zsh.x86_64 0:4.3.10-4.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package Arch     Version                Repository                        Size
================================================================================
Installing:
 ricci   x86_64   0.16.2-35.el6_1.1      rhel-ha-for-rhel-6-server-rpms   614 k
 zsh     x86_64   4.3.10-4.1.el6         rhel-6-server-rpms               2.1 M

Transaction Summary
================================================================================
Install       2 Package(s)

Total download size: 2.7 M
Installed size: 4.3 M
Downloading Packages:
(1/2): ricci-0.16.2-35.el6_1.1.x86_64.rpm                | 614 kB     00:00     
(2/2): zsh-4.3.10-4.1.el6.x86_64.rpm                     | 2.1 MB     00:00     
--------------------------------------------------------------------------------
Total                                           1.1 MB/s | 2.7 MB     00:02     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : zsh-4.3.10-4.1.el6.x86_64                                    1/2 
  Installing : ricci-0.16.2-35.el6_1.1.x86_64                               2/2 
Installed products updated.

Installed:
  ricci.x86_64 0:0.16.2-35.el6_1.1          zsh.x86_64 0:4.3.10-4.1.el6         

Complete!
[root@jsefler-stage-6server ~]# ls /etc/pki/product/
69.pem  83.pem
[root@jsefler-stage-6server ~]# 


^^^ Yes -  "Installed products updated." was printed and the 83.pem product cert was installed for the high availability ricci package.

Now let try again with the --quiet option and verify that the info message coming from subscription-manager is suppressed... 


[root@jsefler-stage-6server ~]# yum -y remove zsh ricci --quiet
[root@jsefler-stage-6server ~]# rm -f /etc/pki/product/83.pem 
[root@jsefler-stage-6server ~]# ls /etc/pki/product/
69.pem
[root@jsefler-stage-6server ~]# yum -y install zsh ricci --quiet
[root@jsefler-stage-6server ~]# ls /etc/pki/product/
69.pem  83.pem
[root@jsefler-stage-6server ~]# 

^^^ VERIFIED - subscription-manager plugin now obeys the yum --quiet option and the product cert 83.pem was installed. 

moving to VERIFIED

Comment 9 errata-xmlrpc 2011-12-06 17:15:11 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-2011-1695.html