From b0c91f9267ed2f8f184cf82ebbb1e39d444dede6 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 18 Jan 2017 21:19:45 +0100 Subject: [PATCH] Move policy.json out of etc Change-Id: I94c5b0f21e28eeaf8d87d33fa59e1e3a26c32a51 --- {etc/aodh => aodh/api}/policy.json | 0 aodh/service.py | 7 +++++-- aodh/tests/functional/api/__init__.py | 5 ----- devstack/plugin.sh | 4 ---- 4 files changed, 5 insertions(+), 11 deletions(-) rename {etc/aodh => aodh/api}/policy.json (100%) diff --git a/etc/aodh/policy.json b/aodh/api/policy.json similarity index 100% rename from etc/aodh/policy.json rename to aodh/api/policy.json diff --git a/aodh/service.py b/aodh/service.py index a6cb2852..5428aa88 100644 --- a/aodh/service.py +++ b/aodh/service.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2013 Red Hat, Inc +# Copyright 2013-2017 Red Hat, Inc # Copyright 2012-2015 eNovance # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -14,6 +14,8 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +import os + from keystoneauth1 import loading as ka_loading from oslo_config import cfg from oslo_db import options as db_options @@ -72,7 +74,8 @@ def prepare_service(argv=None, config_files=None): log.set_defaults(default_log_levels=log_levels) defaults.set_cors_middleware_defaults() 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__), "api", "policy.json"))) from aodh import opts # Register our own Aodh options for group, options in opts.list_opts(): diff --git a/aodh/tests/functional/api/__init__.py b/aodh/tests/functional/api/__init__.py index 512d3543..184a00cb 100644 --- a/aodh/tests/functional/api/__init__.py +++ b/aodh/tests/functional/api/__init__.py @@ -16,8 +16,6 @@ """Base classes for API tests. """ -import os - from oslo_config import fixture as fixture_config import webtest @@ -41,9 +39,6 @@ class FunctionalTest(db_test_base.TestBase): self.CONF = self.useFixture(fixture_config.Config(conf)).conf self.setup_messaging(self.CONF) - self.CONF.set_override('policy_file', - os.path.abspath('etc/aodh/policy.json'), - group='oslo_policy', enforce_type=True) self.CONF.set_override('auth_mode', None, group='api') self.app = webtest.TestApp(app.load_app(self.CONF)) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 6933a9e0..1ef37d27 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -169,10 +169,6 @@ function configure_aodh { setup_colorized_logging $AODH_CONF DEFAULT fi - # Install the policy file for the API server - cp $AODH_DIR/etc/aodh/policy.json $AODH_CONF_DIR - iniset $AODH_CONF oslo_policy policy_file $AODH_CONF_DIR/policy.json - cp $AODH_DIR/etc/aodh/aodh-config-generator.conf $AODH_CONF_DIR # The alarm evaluator needs these options to call gnocchi/ceilometer APIs