diff options
-rw-r--r-- | .mailmap | 1 | ||||
-rw-r--r-- | openstack/common/policy.py | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | openstack/common/rootwrap/cmd.py | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | openstack/common/rpc/zmq_receiver.py | 1 | ||||
-rw-r--r-- | tests/unit/test_policy.py | 5 | ||||
-rwxr-xr-x | tools/config/generate_sample.sh | 3 |
6 files changed, 10 insertions, 3 deletions
@@ -2,3 +2,4 @@ # <preferred e-mail> <other e-mail 1> # <preferred e-mail> <other e-mail 2> Zhongyue Luo <zhongyue.nah@intel.com> <lzyeval@gmail.com> +<yufang521247@gmail.com> <zhangyufang@360.cn> diff --git a/openstack/common/policy.py b/openstack/common/policy.py index 3a3c63f..ffb8668 100644 --- a/openstack/common/policy.py +++ b/openstack/common/policy.py @@ -221,7 +221,7 @@ class Enforcer(object): if policy_file: return policy_file - raise cfg.ConfigFilesNotFoundError(path=CONF.policy_file) + raise cfg.ConfigFilesNotFoundError((CONF.policy_file,)) def enforce(self, rule, target, creds, do_raise=False, exc=None, *args, **kwargs): diff --git a/openstack/common/rootwrap/cmd.py b/openstack/common/rootwrap/cmd.py index 500f6c9..473dafb 100755..100644 --- a/openstack/common/rootwrap/cmd.py +++ b/openstack/common/rootwrap/cmd.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2011 OpenStack Foundation. diff --git a/openstack/common/rpc/zmq_receiver.py b/openstack/common/rpc/zmq_receiver.py index e74da22..000a7dd 100755..100644 --- a/openstack/common/rpc/zmq_receiver.py +++ b/openstack/common/rpc/zmq_receiver.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack Foundation diff --git a/tests/unit/test_policy.py b/tests/unit/test_policy.py index bd412bf..cc2afe7 100644 --- a/tests/unit/test_policy.py +++ b/tests/unit/test_policy.py @@ -208,6 +208,11 @@ class EnforcerTest(PolicyBaseTestCase): self.assertEquals(self.enforcer.rules, {'test': 'test', 'test1': 'test1'}) + def test_get_policy_path_raises_exc(self): + enforcer = policy.Enforcer(policy_file='raise_error.json') + self.assertRaises(cfg.ConfigFilesNotFoundError, + enforcer._get_policy_path) + class FakeCheck(policy.BaseCheck): def __init__(self, result=None): diff --git a/tools/config/generate_sample.sh b/tools/config/generate_sample.sh index 26f02dd..f5e5a67 100755 --- a/tools/config/generate_sample.sh +++ b/tools/config/generate_sample.sh @@ -64,6 +64,9 @@ FILES=$(find $BASEDIR/$PACKAGENAME -type f -name "*.py" ! -path "*/tests/*" \ export EVENTLET_NO_GREENDNS=yes +OS_VARS=$(set | sed -n '/^OS_/s/=[^=]*$//gp' | xargs) +[ "$OS_VARS" ] && eval "unset \$OS_VARS" + MODULEPATH=openstack.common.config.generator OUTPUTFILE=$OUTPUTDIR/$PACKAGENAME.conf.sample python -m $MODULEPATH $FILES > $OUTPUTFILE |