Skip to content

Commit

Permalink
Raise proper exception if policy file do not exist
Browse files Browse the repository at this point in the history
Fixes bug 1022966.

Change-Id: Ia1f9a95eb9e956d0d65efb50e674de18d0552b6e
  • Loading branch information
ljjjustin committed Jul 17, 2012
1 parent b5db77a commit 2cb3056
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions quantum/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
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"),
Expand Down
5 changes: 3 additions & 2 deletions quantum/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

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


Expand All @@ -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())

Expand Down

0 comments on commit 2cb3056

Please sign in to comment.