Move default policy.json away from etc/

This makes it easier to install Gnocchi while still having the proper
default easy to override.

Change-Id: Ie923e05d0c25d0352d6352dc6c47d90bdf3249d5
This commit is contained in:
Julien Danjou 2017-01-03 14:23:35 +01:00
parent 6964ac23a2
commit 37db178436
4 changed files with 6 additions and 19 deletions

View File

@ -1,4 +1,4 @@
# Copyright (c) 2016 Red Hat, Inc.
# Copyright (c) 2016-2017 Red Hat, Inc.
# Copyright (c) 2015 eNovance
# Copyright (c) 2013 Mirantis Inc.
#
@ -14,6 +14,7 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from oslo_config import cfg
from oslo_db import options as db_options
@ -37,7 +38,10 @@ def prepare_service(args=None, conf=None,
# FIXME(jd) Use the pkg_entry info to register the options of these libs
log.register_options(conf)
db_options.set_defaults(conf)
policy_opts.set_defaults(conf)
policy_opts.set_defaults(conf, policy_file=os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"rest", "policy.json")))
# Register our own Gnocchi options
for group, options in opts.list_opts():

View File

@ -188,25 +188,11 @@ class TestCase(base.BaseTestCase):
),
}
@staticmethod
def path_get(project_file=None):
root = os.path.abspath(os.path.join(os.path.dirname(__file__),
'..',
'..',
)
)
if project_file:
return os.path.join(root, project_file)
return root
@classmethod
def setUpClass(self):
super(TestCase, self).setUpClass()
self.conf = service.prepare_service([],
default_config_files=[])
self.conf.set_override('policy_file',
self.path_get('etc/gnocchi/policy.json'),
group="oslo_policy")
# NOTE(jd) This allows to test S3 on AWS
if not os.getenv("AWS_ACCESS_KEY_ID"):

View File

@ -95,9 +95,6 @@ class ConfigFixture(fixture.GabbiFixture):
# and thus should override conf settings.
if 'DEVSTACK_GATE_TEMPEST' not in os.environ:
conf.set_override('driver', 'file', 'storage')
conf.set_override('policy_file',
os.path.abspath('etc/gnocchi/policy.json'),
group="oslo_policy")
conf.set_override('file_basepath', data_tmp_dir, 'storage')
# NOTE(jd) All of that is still very SQL centric but we only support