Bug 548111

Summary: yum-rhn-plugin does not log any package action locally - with solution
Product: Red Hat Enterprise Linux 5 Reporter: Peter Bieringer <pb>
Component: yum-rhn-pluginAssignee: Miroslav Suchý <msuchy>
Status: CLOSED DUPLICATE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: low    
Version: 5.4CC: xdmoon
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: 2009-12-17 08:41: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:
Attachments:
Description Flags
Patch in diff format none

Description Peter Bieringer 2009-12-16 16:42:38 UTC
Description of problem:
system controlled by Spacewalk/RHN Satellite will not log anything about remote controlled package actions like install or erase.

Version-Release number of selected component (if applicable):
yum-rhn-plugin-0.6.2-1.el5 (CentOS 5.4)
yum-rhn-plugin-0.5.4-13.el5 (RHEL 5.4)

How reproducible:
Always

Steps to Reproduce:
1. Trigger install or erase of a package in Spacewalk / RHN Satellite
  
Actual results:
Nothing useful found, neither in /var/log/up2date nor in /var/log/yum.log

Expected results:
Name/Version/Release of package and related action found in local system log


Additional info:
After some debugging I found a quick, simple and imho proper solution by a small patch.


--- /usr/share/rhn/actions/packages.py.orig     2009-12-16 15:50:31.000000000 +0000
+++ /usr/share/rhn/actions/packages.py  2009-12-16 16:32:11.000000000 +0000
@@ -133,6 +133,12 @@
         log.log_debug('Running Transaction')
         self.runTransaction(testcb)

+        for txmbr in self.tsInfo.getMembers():
+            if txmbr.ts_state in ['i', 'u']:
+               log.log_me('Installed: ', txmbr.name, '-', txmbr.version, '-', txmbr.release, '.', txmbr.arch)
+            if txmbr.ts_state in ['e']:
+               log.log_me('Erased: ', txmbr.name, '-', txmbr.version, '-', txmbr.release, '.', txmbr.arch)
+
         # close things
         return 0

@@ -285,6 +291,10 @@

     for package in package_list:
         transaction_data['packages'].append((package, action))
+        if action in ['i', 'u']:
+               log.log_me('Install: ', package[0], '-', package[1], '-', package[2], '.', package[4])
+        if action in ['e']:
+               log.log_me('Erase: ', package[0], '-', package[1], '-', package[2], '.', package[4])

     return transaction_data


This results in e.g. follwing log lines:

[Wed Dec 16 16:31:22 2009] up2date updateLoginInfo() login info
[Wed Dec 16 16:31:22 2009] up2date logging into up2date server
[Wed Dec 16 16:31:22 2009] up2date successfully retrieved authentication token from up2date server
[Wed Dec 16 16:31:22 2009] up2date Install: aalib-devel-1.4.0-0.11.rc5.el5.i386
[Wed Dec 16 16:31:26 2009] up2date Updating package profile
[Wed Dec 16 16:31:27 2009] up2date Installed: aalib-1.4.0-0.11.rc5.el5.i386
[Wed Dec 16 16:31:27 2009] up2date Installed: aalib-devel-1.4.0-0.11.rc5.el5.i386
[Wed Dec 16 16:31:27 2009] up2date Updating package profile

Note: the triggered package and the install with resolved dependencies is logged.


Same for deinstall:

[Wed Dec 16 16:40:19 2009] up2date updateLoginInfo() login info
[Wed Dec 16 16:40:19 2009] up2date logging into up2date server
[Wed Dec 16 16:40:19 2009] up2date successfully retrieved authentication token from up2date server
[Wed Dec 16 16:40:19 2009] up2date Erase: aalib-1.4.0-0.11.rc5.el5.i386
[Wed Dec 16 16:40:21 2009] up2date Updating package profile
[Wed Dec 16 16:40:21 2009] up2date Erased: aalib-1.4.0-0.11.rc5.el5.i386
[Wed Dec 16 16:40:21 2009] up2date Erased: aalib-devel-1.4.0-0.11.rc5.el5.i386
[Wed Dec 16 16:40:21 2009] up2date Updating package profile


Pls. push this forward, because this will sure help many people, especially for system auditing, when a package "has left" a system or what was installed in dependency of an triggered installed.

Comment 1 Peter Bieringer 2009-12-16 16:44:09 UTC
Created attachment 378788 [details]
Patch in diff format

Comment 2 Miroslav Suchý 2009-12-17 08:41:11 UTC
It was reggression, which has been fixed in yum-rhn-plugin-0.7.7-1
In /var/log/up2date you should be able to see lines like:
[Sun Oct  4 17:42:02 2009] up2date Adding packages to package profile:
['wget-1.11.4-2.el5']

*** This bug has been marked as a duplicate of bug 527412 ***

Comment 3 Peter Bieringer 2009-12-17 14:01:18 UTC
Where can I download an RHEL 5.4 compatible RPM of yum-rhn-plugin?

Comment 4 Peter Bieringer 2009-12-17 14:03:18 UTC
Sorry, found here now: http://miroslav.suchy.cz/spacewalk/nightly-candidate-client/el5/i386/os/

Comment 5 Peter Bieringer 2009-12-17 14:12:27 UTC
Just note for installing the 0.7.8 release, I have to install also 

 python-ethtool.i386 0:0.3-5.el5 from Spacewalk nightly builds

and

 python-dmidecode.i386 0:3.10.7-3.el5 from EPEL testing

Imho, this should be improved somehow and coordinated before final release. It' strange to require packages from EPEL if connecting a client to spacewalk.

Comment 6 Peter Bieringer 2009-12-17 14:18:08 UTC
I personally would like that the log output would change from this simple "print array" to one like /var/log/yum.log

Instead of:

[Thu Dec 17 14:14:02 2009] up2date Adding packages to package profile: ['aalib-devel-1.4.0-0.11.rc5.el5', 'aalib-1.4.0-0.11.rc5.el5']
[Thu Dec 17 14:14:02 2009] up2date Removing packages from package profile: []

The following looks better:

[Wed Dec 16 16:31:27 2009] up2date Installed: aalib-1.4.0-0.11.rc5.el5.i386
[Wed Dec 16 16:31:27 2009] up2date Installed:
aalib-devel-1.4.0-0.11.rc5.el5.i386

Comment 7 Miroslav Suchý 2009-12-17 15:16:59 UTC
re #3 and #4 - more correct link is 
http://spacewalk.redhat.com/yum/0.7-client/RHEL/5/i386/yum-rhn-plugin-0.7.8-1.el5.noarch.rpm

re #5 this is how it works in spacewalk - we move fast. and do not include packages from epel or epel-testing in our repo. If you want it in one pack, you should think about RHN Satellite, where is everything nice and polished.

re #6 this format has been here since RHEL 5.0, we will definitely stick with this format, if you fell the other format has big advantage, you can start discussion on spacewalk-devel mailing list.