wsgi.Loader should ensure the config_path is absolute

Bug #1259183 reported by Xavier Queralt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Unassigned

Bug Description

nova-api service will fail to start when the nova-api command is invoked from a directory containing a file with the same name as the one specified in the configuration key 'api_paste_config' if it is not an absolute path (the default is 'api-paste.ini').

[fedora@devstack1 devstack]$ pwd
/home/fedora/devstack

[fedora@devstack1 devstack]$ grep api_paste_conf /etc/nova/nova.conf
api_paste_config = api-paste.ini

[fedora@devstack1 devstack]$ touch api-paste.ini

[fedora@devstack1 devstack]$ nova-api
2013-12-09 09:18:40.082 DEBUG nova.wsgi [-] Loading app ec2 from api-paste.ini from (pid=4817) load_app /opt/stack/nova/nova/wsgi.py:485
2013-12-09 09:18:40.083 CRITICAL nova [-] Cannot resolve relative uri 'config:api-paste.ini'; no relative_to keyword argument given
2013-12-09 09:18:40.083 TRACE nova Traceback (most recent call last):
2013-12-09 09:18:40.083 TRACE nova File "/usr/bin/nova-api", line 10, in <module>
2013-12-09 09:18:40.083 TRACE nova sys.exit(main())
2013-12-09 09:18:40.083 TRACE nova File "/opt/stack/nova/nova/cmd/api.py", line 49, in main
2013-12-09 09:18:40.083 TRACE nova max_url_len=16384)
2013-12-09 09:18:40.083 TRACE nova File "/opt/stack/nova/nova/service.py", line 308, in __init__
2013-12-09 09:18:40.083 TRACE nova self.app = self.loader.load_app(name)
2013-12-09 09:18:40.083 TRACE nova File "/opt/stack/nova/nova/wsgi.py", line 486, in load_app
2013-12-09 09:18:40.083 TRACE nova return deploy.loadapp("config:%s" % self.config_path, name=name)
2013-12-09 09:18:40.083 TRACE nova File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
2013-12-09 09:18:40.083 TRACE nova return loadobj(APP, uri, name=name, **kw)
2013-12-09 09:18:40.083 TRACE nova File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 271, in loadobj
2013-12-09 09:18:40.083 TRACE nova global_conf=global_conf)
2013-12-09 09:18:40.083 TRACE nova File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
2013-12-09 09:18:40.083 TRACE nova global_conf=global_conf)
2013-12-09 09:18:40.083 TRACE nova File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 308, in _loadconfig
2013-12-09 09:18:40.083 TRACE nova "argument given" % uri)
2013-12-09 09:18:40.083 TRACE nova ValueError: Cannot resolve relative uri 'config:api-paste.ini'; no relative_to keyword argument given
2013-12-09 09:18:40.083 TRACE nova

Revision history for this message
Xavier Queralt (xqueralt-deactivatedaccount) wrote :

Fix proposed to branch: master
https://review.openstack.org/#/c/60838/

Changed in nova:
assignee: nobody → Xavier Queralt (xqueralt)
importance: Undecided → Low
Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/60838
Committed: http://github.com/openstack/nova/commit/6037b9cc20a8ab379855370394e108912ea3a0f2
Submitter: Jenkins
Branch: master

commit 6037b9cc20a8ab379855370394e108912ea3a0f2
Author: Xavier Queralt <email address hidden>
Date: Mon Dec 9 15:21:01 2013 +0100

    Ensure api_paste_conf is an absolute path

    If api_paste_conf is specified as a relative path and the directory from
    where the nova-api service is started contains a file with the same
    name, the wsgi loader won't try to find the absolute path to that file
    which is required when not passing the base directory to the
    paste.deploy library.

    This change ensures the config_path is an absolute path so it can be
    found by the paste.deploy library.

    Closes-Bug: #1259183
    Change-Id: I0eb6ef1d69d302634b8c842449f997ec10c13933

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-2
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-2 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.