Bug 811130 - openstack-glance-db-setup creates logfile owned by root
Summary: openstack-glance-db-setup creates logfile owned by root
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: openstack-glance
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Pádraig Brady
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-04-10 08:41 UTC by Jan van Eldik
Modified: 2012-04-12 02:41 UTC (History)
13 users (show)

Fixed In Version: openstack-glance-2012.1-3.fc17
Clone Of:
Environment:
Last Closed: 2012-04-12 02:41:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jan van Eldik 2012-04-10 08:41:49 UTC
Description of problem:

Running

  $> sudo openstack-nova-db-setup

as per http://fedoraproject.org/wiki/Getting_started_with_OpenStack_on_Fedora_17
creates a logfile owned by root:

  $> ls -l /var/log/glance/registry.log
  -rw-r--r--. 1 root root 132 Apr 10 10:32 /var/log/glance/registry.log

This prevents the glance-registry service from starting - it runs under the
"glance" account, and cannot write to the logfile.

Version-Release number of selected component (if applicable):

  $> rpm -qf /usr/bin/openstack-glance-db-setup 
  openstack-glance-2012.1-0.11.rc2.fc16.noarch

How reproducible:

100%

Steps to Reproduce:

Simply run "sudo /usr/bin/openstack-glance-db-setup"
  
Additional info:

(Re-) Moving the logfile solves the issue.

Comment 1 Jan van Eldik 2012-04-10 08:52:47 UTC
Also present in openstack-glance-2012.1-1.fc16.noarch

Comment 2 Pádraig Brady 2012-04-10 11:54:00 UTC
Good one. This happens on new systems where openstack-glance-db-setup is run before glance ever was. I.E. the norm for users. This should fix it...

diff --git a/openstack-glance-db-setup b/openstack-glance-db-setup
index e1f0eb9..95a2a83 100755
--- a/openstack-glance-db-setup
+++ b/openstack-glance-db-setup
@@ -247,12 +247,10 @@ fi
 # Ask openstack-$APP to sync the db.
 
 echo "Asking openstack-$APP to sync the database."
-if [ "${APP}" = "nova" ]; then
-       nova-manage db sync
-else
-       # glance and keystone
-       $APP-manage db_sync
-fi
+[ "${APP}" = "nova" ] && db_sync='db sync' || db_sync='db_sync'
+# Run as $APP user so any newly created (log) files have correct ownership
+runuser -s /bin/sh $APP -c "$APP-manage $db_sync"

Fix coming up...

Comment 3 Fedora Update System 2012-04-10 13:30:00 UTC
openstack-glance-2012.1-2.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/openstack-glance-2012.1-2.fc17

Comment 4 Pádraig Brady 2012-04-10 14:00:32 UTC
Note the build above is for F17, but you might be able to install manually on your F16 system.

I checked keystone and its "db sync" process does not create log files.
I checked nova, and its does, but only for the nova-manage command which
is generally run as root anyway.
In any case all services will soon update to a shared db-setup script which will manage permissions consistently.

Comment 5 Jan van Eldik 2012-04-10 14:25:17 UTC
Works fine on F16, Karma given.

Thanks!

Comment 6 Fedora Update System 2012-04-10 20:18:37 UTC
Package openstack-glance-2012.1-2.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing openstack-glance-2012.1-2.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-5594/openstack-glance-2012.1-2.fc17
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2012-04-10 21:36:14 UTC
openstack-glance-2012.1-3.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/openstack-glance-2012.1-3.fc17

Comment 8 Fedora Update System 2012-04-10 21:36:21 UTC
openstack-glance-2012.1-3.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/openstack-glance-2012.1-3.fc17

Comment 9 Fedora Update System 2012-04-12 02:41:38 UTC
openstack-glance-2012.1-3.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.


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