Correct use of ConfigFilesNotFoundError

ConfigFilesNotFoundError.__init__() takes "config_files", not
"path". And pass the config value itself rather than the result
of find_file(), which is always None.

Change-Id: Ia5285d252d5636892c4fbeb9191a6c7ed4923b78
Closes-Bug: 1236176
(cherry picked from commit 84b02ca1d5)
This commit is contained in:
Arata Notsu 2013-10-08 13:18:04 +09:00 committed by Russell Bryant
parent 96d828fb69
commit d120cedb4e
2 changed files with 9 additions and 1 deletions

View File

@ -151,7 +151,7 @@ class CellStateManager(base.Base):
if cells_config:
config_path = CONF.find_file(cells_config)
if not config_path:
raise cfg.ConfigFilesNotFoundError(path=config_path)
raise cfg.ConfigFilesNotFoundError(config_files=[cells_config])
return CellStateManagerFile(cell_state_cls, config_path)
return CellStateManagerDB(cell_state_cls)

View File

@ -16,6 +16,8 @@
Tests For CellStateManager
"""
from oslo.config import cfg
from nova.cells import state
from nova import db
from nova.db.sqlalchemy import models
@ -65,6 +67,12 @@ class TestCellsStateManager(test.TestCase):
self.stubs.Set(db, 'compute_node_get_all', _fake_compute_node_get_all)
self.stubs.Set(db, 'flavor_get_all', _fake_instance_type_all)
def test_cells_config_not_found(self):
self.flags(cells_config='no_such_file_exists.conf', group='cells')
e = self.assertRaises(cfg.ConfigFilesNotFoundError,
state.CellStateManager)
self.assertEqual(['no_such_file_exists.conf'], e.config_files)
def test_capacity_no_reserve(self):
# utilize entire cell
cap = self._capacity(0.0)