Bug 888671 - [Installation]oo-accept-broker or oo-accept-systems will create production.log, the file's permission is wrong.
Summary: [Installation]oo-accept-broker or oo-accept-systems will create production.lo...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Node
Version: 1.2.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
: ---
Assignee: Brenton Leanhardt
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-19 07:50 UTC by xjia
Modified: 2017-03-08 17:34 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-01-31 20:33:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0220 0 normal SHIPPED_LIVE Important: Red Hat OpenShift Enterprise 1.1 update 2013-02-01 01:23:24 UTC

Description xjia 2012-12-19 07:50:19 UTC
Description of problem:
By default, the log file "/var/www/openshift/broker/log/production.log" does not exist. It will be created if user operates his app or other things. and the permission is "apache:apache".

After install broker, I will execute oo-accept-broker or  oo-accept-systems to check the config of system is right. The log file will be created. And the permission is wrong, it is "root:root".

Now, if execute "rhc setup", it will be some error in the "/var/www/openshift/broker/httpd/logs/error_log" :
Rails Error: Unable to access log file. Please ensure that /var/www/openshift/broker/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.

Version-Release number of selected component (if applicable):
http://buildvm-devops.usersys.redhat.com/puddle/build/OpenShiftEnterprise/1.1.x/2012-12-18.1

How reproducible:
always

Steps to Reproduce:
1. Setup broker, make sure the log file(/var/www/openshift/broker/log/production.log) doesn't exist
2. Execute  oo-accept-systems
3. Check the log file's permission
ll /var/www/openshift/broker/log/production.log
4. On client side, execute "rhc setup"
5. Check the http log file (/var/www/openshift/broker/httpd/logs/error_log)

Actual results:
3.[root@broker ~]# ll /var/www/openshift/broker/log/production.log 
-rw-r--r--. 1 root root 0 Dec 19 02:19 /var/www/openshift/broker/log/production.log

5.Rails Error: Unable to access log file. Please ensure that /var/www/openshift/broker/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.

Expected results:
3. The file still doesn't exsit, please don't touch this file.
5. If step 3 is fixed, step 5 will not show error about the log file's permission.

Additional info:

Comment 2 Brenton Leanhardt 2012-12-19 13:42:53 UTC
Great catch.

This was actually due to a fairly recent change where I marked the log files as %ghost because that was technically more correct from an RPM standpoint.  Since those script actually run the rails environment we do need to be more protective.

I'll revert back to having the broker RPM create the files and setup the correct ownership.

Comment 3 Brenton Leanhardt 2012-12-19 14:41:37 UTC
Upstream pull request:
https://github.com/openshift/origin-server/pull/1089

After looking at the code I remember why %ghost was added.  We wanted to avoid log files from being overwritten on RPM upgrade.

Comment 4 Brenton Leanhardt 2012-12-20 16:15:26 UTC
The latest upstream pull requests is here:
https://github.com/openshift/origin-server/pull/1096

Comment 5 Brenton Leanhardt 2012-12-21 20:38:03 UTC
This will ship with the next 1.1 puddle.

Comment 6 Johnny Liu 2013-01-04 05:10:55 UTC
Retest this bug with 1.1.x/2013-01-02.1 puddle, and FAIL.


1. After install broker package, the log files are not generated.
# ll /var/www/openshift/broker/log/production.log
ls: cannot access /var/www/openshift/broker/log/production.log: No such file or directory

2. run "oo-accept-systems" and "oo-accept-broker" to check the log file's permission.
# ll /var/www/openshift/broker/log/production.log
-rw-r--r--. 1 root root 0 Jan  3 22:32 /var/www/openshift/broker/log/production.log

Comment 7 Johnny Liu 2013-01-04 07:12:03 UTC
Oops, it is my fault, in comment 6, I used an old puddle to test this bug, so pls ignore comment 6. I will verify this bug soon.

Comment 8 Johnny Liu 2013-01-04 07:14:14 UTC
Verified this bug with 1.1.x/2013-01-02.1 puddle, and PASS.

# rpm -q --scripts openshift-origin-broker-1.0.7-1.el6op.noarch
postinstall scriptlet (using /bin/sh):

# We are forced to create these log files if they don't exist because we have
# command line tools that will load the Rails environment and create the logs
# as root.  We need the files labeled %ghost because we don't want these log
# files overwritten on RPM upgrade.
for l in /var/log/openshift/user_action.log /var/www/openshift/broker/log/{development,production}.log; do
  if [ ! -f $l ]; then
    touch $l
  fi
  chown apache:apache $l
  chmod 640 $l
done

<--snip-->

After install broker package, the log files are generated with correct permission.
[root@broker ~]# ll /var/log/openshift/user_action.log
-rw-r-----. 1 apache apache 306756 Jan  4 02:09 /var/log/openshift/user_action.log
[root@broker ~]# ll /var/www/openshift/broker/log/production.log 
-rw-r-----. 1 apache apache 549818 Jan  4 02:10 /var/www/openshift/broker/log/production.log

Run "oo-accept-systems" and "oo-accept-broker" to check the log file's permission, they are still correct.

Comment 10 errata-xmlrpc 2013-01-31 20:33:44 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/RHSA-2013-0220.html


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