OpenStack Compute (Nova)

[Nova-manage] please give a nicer failure message

Reported by Alexey Eromenko on 2012-02-23
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Low
Russell Bryant

Bug Description

Executing nova-manage with normal user privileges fails.

My understanding is that this is due to security features.
At any rate - at least it should give a readable error message, like:

run with 'root' permissions. And exit.

myuser@nova-server1:~$ nova-manage user list
Traceback (most recent call last):
 File "/usr/bin/nova-manage", line 2376, in <module>
  main()
 File "/usr/bin/nova-manage", line 2316, in main
  logging.setup()
 File "/usr/lib/python2.7/dist-packages/nova/log.py", line 349, in setup
  logging.root = NovaRootLogger("nova")
 File "/usr/lib/python2.7/dist-packages/nova/log.py", line 284, in __init__
  NovaLogger.__init__(self, name, level)
 File "/usr/lib/python2.7/dist-packages/nova/log.py", line 142, in __init__
  self.setup_from_flags()
 File "/usr/lib/python2.7/dist-packages/nova/log.py", line 299, in
setup_from_flags
  self.filelog = WatchedFileHandler(logpath)
 File "/usr/lib/python2.7/logging/handlers.py", line 386, in __init__
  logging.FileHandler.__init__(self, filename, mode, encoding, delay)
 File "/usr/lib/python2.7/logging/__init__.py", line 897, in __init__
  StreamHandler.__init__(self, self._open())
 File "/usr/lib/python2.7/logging/__init__.py", line 916, in _open
  stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/log/nova/nova-manage.log'

Workas as root:

root@nova-server1:~# nova-manage user list
novaadmin

Platform: Debian 7.0 / Wheezy-testing.

Related to Debian Bug:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=660893

Related to Keystone Bug:
[Keystone-manage] please give a nicer failure message
https://bugs.launchpad.net/keystone/+bug/939523

--
-Alexey Eromenko "Technologov", 23.feb.2012.

Russell Bryant (russellb) wrote :

This appears to have been addressed by a patch for bug 805695. This patch will be in essex-4. It will automatically switch to running with sudo for you if you run it as a regular user (user that can't read the nova config file).

Changed in nova:
status: New → Fix Committed
importance: Undecided → Wishlist
milestone: none → essex-4
assignee: nobody → Russell Bryant (russellb)

On Thu, Feb 23, 2012 at 6:32 PM, Russell Bryant
<email address hidden> wrote:
> *** This bug is a duplicate of bug 805695 ***
>    https://bugs.launchpad.net/bugs/805695
>
> This appears to have been addressed by a patch for bug 805695.  This
> patch will be in essex-4.  It will automatically switch to running with
> sudo for you if you run it as a regular user (user that can't read the
> nova config file).

sudo will not work on non-ubuntu platforms, as it is normally disabled there.

nice error message would help.
--
-Alexey Eromenko "Technologov"

Changed in nova:
milestone: essex-4 → none
status: Fix Committed → Confirmed
Russell Bryant (russellb) wrote :

Good point. I'll post a patch.

Changed in nova:
importance: Wishlist → Low

Fix proposed to branch: master
Review: https://review.openstack.org/4454

Changed in nova:
status: Confirmed → In Progress
Russell Bryant (russellb) wrote :

with patch:

    $ bin/nova-manage user list
    Could not read /etc/nova/nova.conf. Re-running with sudo
    sudo failed, continuing as if nothing happened
    Please re-run nova-manage as root.

Reviewed: https://review.openstack.org/4454
Committed: http://github.com/openstack/nova/commit/ab69635cc1c91f09efc20b31512554722e4a7928
Submitter: Jenkins
Branch: master

commit ab69635cc1c91f09efc20b31512554722e4a7928
Author: Russell Bryant <email address hidden>
Date: Thu Feb 23 13:32:14 2012 -0500

    Print error if nova-manage should be run as root.

    Fix bug 939531.

    This patch makes nova-manage print out a more friendly error message if
    it needs to be run as root instead of failing with an exception
    traceback. It catches an EACCES error when opening the config file or
    opening log files and exits cleanly.

    Change-Id: I2bd2bf3750c2bd3d672a037edb56f2b0b9bf1379

Changed in nova:
status: In Progress → Fix Committed
Alexey Eromenko (al4321) wrote :

Thanks !

Changed in nova:
milestone: none → essex-4
Thierry Carrez (ttx) on 2012-02-29
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in nova:
milestone: essex-4 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers