Load config options

Rally < 0.12 loads only inner config options, so we need to load
rally-openstack options manually.
Hope, Rally 0.12 will fix the issue.

Change-Id: Ib19c58b15229874a27187ab036dc982a1fd9d803
This commit is contained in:
Andrey Kurilin 2018-04-25 16:01:32 +03:00
parent 6158c1139c
commit 75ab0a28ea
3 changed files with 32 additions and 6 deletions

View File

@ -0,0 +1,29 @@
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from rally.common import version as _rally_version
_version_tuple = _rally_version.version_info.semantic_version().version_tuple()
if _version_tuple < (0, 12):
# NOTE(andreykurilin): Rally < 0.12 doesn't care about loading options from
# external packages, so we need to handle it manually.
from rally.common import opts as global_opts
from rally_openstack.cfg import opts
# ensure that rally options are registered.
global_opts.register()
global_opts.register_opts(opts.list_opts().items())

View File

@ -31,6 +31,7 @@ setup-hooks =
[entry_points]
rally_plugins =
path = rally_openstack
options = rally_openstack.cfg.opts:list_opts
[build_sphinx]
all_files = 1

View File

@ -591,18 +591,14 @@ def check_opts_import_path(logical_line, physical_line, filename):
N342
"""
excluded_files = ["./rally/task/engine.py",
"./rally/task/context.py",
"./rally/task/scenario.py",
"./rally/common/opts.py"]
excluded_files = ["./rally_openstack/__init__.py"]
forbidden_methods = [".register_opts("]
if filename not in excluded_files:
for forbidden_method in forbidden_methods:
if logical_line.find(forbidden_method) != -1:
yield (0, "N342 All options should be loaded from correct "
"paths only. For 'openstack' "
"its './rally/plugin/openstack/cfg'")
"paths only - rally_openstack.cfg module.")
def factory(register):