Bug 1134578 - The Broker's user_action.log should not be overwritten on RPM upgrade
Summary: The Broker's user_action.log should not be overwritten on RPM upgrade
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Node
Version: 2.1.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
: ---
Assignee: Luke Meyer
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-27 20:19 UTC by Brenton Leanhardt
Modified: 2015-02-12 13:09 UTC (History)
6 users (show)

Fixed In Version: openshift-origin-broker-1.16.2.3-1, rubygem-openshift-origin-node-1.34.1.1-1, openshift-origin-console-1.16.3.3-1
Doc Type: Bug Fix
Doc Text:
Cause: RPM packaging did not ghost log files properly. Consequence: Removing the broker, node, or console packages would remove log files. Fix: RPM packaging has been updated to ensure that log files are not removed when the packages are removed. Result: Log files are preserved when removing broker, node, or console packages.
Clone Of:
Environment:
Last Closed: 2015-02-12 13:09:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0220 0 normal SHIPPED_LIVE Red Hat OpenShift Enterprise 2.2.4 bug fix and enhancement update 2015-02-12 18:08:20 UTC

Description Brenton Leanhardt 2014-08-27 20:19:59 UTC
Description of problem:

(moving from https://github.com/openshift/origin-server/issues/977)

Right now openshift-origin-broker overwrites /var/log/openshift/user_action.log on upgrade. It's not as simple as marking that file as %ghost since if the file isn't created with the proper SELinux context the broker will not be able to write to it. Also, currently the broker does not create that file. In order to correctly label it as %ghost we'll need the broker to handle creating that file.

Comment 2 Luke Meyer 2014-08-29 15:26:19 UTC
Actually there's already a %post to create the files correctly as needed.
https://github.com/openshift/origin-server/blob/721854dbe2fd45e4fbeeb93a0872b8b03648224c/broker/openshift-origin-broker.spec#L240-L250

However, they're also created and owned by the spec:
https://github.com/openshift/origin-server/blob/721854dbe2fd45e4fbeeb93a0872b8b03648224c/broker/openshift-origin-broker.spec#L153-L157
https://github.com/openshift/origin-server/blob/721854dbe2fd45e4fbeeb93a0872b8b03648224c/broker/openshift-origin-broker.spec#L199

I think all we have to do is... not do those touches. 

Do we even need to make them %ghost? That just makes them disappear when the RPM is uninstalled.

Comment 3 Brenton Leanhardt 2014-08-29 15:51:04 UTC
The %post snipped is needed to ensure that the log files actually exist before anyone runs one of the admin tools.  Labeling the files %ghost probably wasn't needed and I see it has since been removed.

Originally the files were listed in the spec just like the code and on upgrade they were overwritten.  I added the %ghost tag and the %post snippet.  The git commit history doesn't say exactly why %ghost was removed but I suspect it was so that the logs would stick around after RPM removal.  That github issue was really old and filing this bug was mostly a reminder to verify that the current state is actually working as expected.

Comment 4 Brenton Leanhardt 2014-08-29 15:54:35 UTC
To be clear, removing %ghost works because the file entries were removed entirely.

Comment 5 Luke Meyer 2014-09-29 19:54:32 UTC
Just going to verify this actually is not a problem any more, or fix if it is.

Comment 6 Luke Meyer 2014-10-16 22:08:30 UTC
Updating the broker still seems to be blowing these log files away. Will have to figure out why that is.

Comment 8 openshift-github-bot 2014-12-17 19:54:23 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/158523318acd8c3b38044757d377ec96720ae249
Revert "we do not want %ghost-ed log files"

This reverts commit 0550ff74df3acb60f391dcd4b1f297ae881b36ea.
We do in fact want the log files to be %ghost so they are not
overwritten on every update.

Bug 1134578 - The Broker's user_action.log should not be overwritten on RPM upgrade
https://bugzilla.redhat.com/show_bug.cgi?id=1134578

Comment 11 Ma xiaoqiang 2015-01-26 06:12:00 UTC
Check on puddle [2.2.4/2015.01.23.2]

1.write 'xiama' in the log file
#echo xiama >>/var/log/openshift/broker/development.log 
#echo xiama >>/var/log/openshift/broker/development.log 
#echo xiama >>/var/log/openshift/broker/user_action.log
#echo xiama >>/var/log/openshift/broker/usage.log

2. update the openshift-origin-broker to '1.16.2.2-1.el6op'version 
3. check the log file
all log file is rewrote.

4.write 'xiama' in the log file
#echo xiama >>/var/log/openshift/broker/development.log 
#echo xiama >>/var/log/openshift/broker/development.log 
#echo xiama >>/var/log/openshift/broker/user_action.log
#echo xiama >>/var/log/openshift/broker/usage.log

5. update the openshift-origin-broker to '1.16.2.3-1.el6op'version 
6. check the log file
#grep xiama  /var/log/openshift/broker/*
/var/log/openshift/broker/development.log:xiama
/var/log/openshift/broker/production.log:xiama
/var/log/openshift/broker/usage.log:xiama
/var/log/openshift/broker/user_action.log:xiama

Can not reproduce this issue on node and console log

Comment 13 errata-xmlrpc 2015-02-12 13:09:21 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.

https://rhn.redhat.com/errata/RHBA-2015-0220.html


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