Raise proper exception if policy file do not exist
Fixes bug 1022966. Change-Id: Ia1f9a95eb9e956d0d65efb50e674de18d0552b6e
This commit is contained in:
parent
65e5f370e4
commit
16042a0d82
@ -37,6 +37,7 @@ bind_opts = [
|
||||
cfg.IntOpt('bind_port', default=9696),
|
||||
cfg.StrOpt('api_paste_config', default="api-paste.ini"),
|
||||
cfg.StrOpt('api_extensions_path', default=""),
|
||||
cfg.StrOpt('policy_file', default="policy.json"),
|
||||
cfg.StrOpt('core_plugin',
|
||||
default='quantum.plugins.sample.SamplePlugin.FakePlugin'),
|
||||
cfg.StrOpt('base_mac', default="fa:16:3e:00:00:00"),
|
||||
|
@ -23,6 +23,7 @@ import os.path
|
||||
|
||||
from quantum.common import exceptions
|
||||
from quantum.common.utils import find_config_file
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import policy
|
||||
|
||||
|
||||
@ -38,9 +39,9 @@ def reset():
|
||||
def init():
|
||||
global _POLICY_PATH
|
||||
if not _POLICY_PATH:
|
||||
_POLICY_PATH = find_config_file({}, 'policy.json')
|
||||
_POLICY_PATH = find_config_file({}, cfg.CONF.policy_file)
|
||||
if not _POLICY_PATH:
|
||||
raise exceptions.PolicyNotFound(path=FLAGS.policy_file)
|
||||
raise exceptions.PolicyNotFound(path=cfg.CONF.policy_file)
|
||||
with open(_POLICY_PATH) as f:
|
||||
_set_brain(f.read())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user