From 28df7861bb547b1e71234f2b0fe61f5af1399082 Mon Sep 17 00:00:00 2001 From: Andrey Kurilin Date: Mon, 12 Feb 2018 15:41:43 +0200 Subject: [PATCH] [cfg] Introduce rally.common.cfg As for config options we are using oslo_config library. It limits us to override config options based on used deployment/env. To get control of all options and how they are obtained, let's restrict usage of oslo_config directly and force everyone to use rally.common.cfg which has the same interface. Change-Id: Ia845958b50b62d971f1343c03da2552049aa4363 --- etc/rally/rally.conf.sample | 5 ++ rally/api.py | 2 +- rally/cli/cliutils.py | 2 +- rally/cli/commands/db.py | 3 +- rally/common/cfg.py | 63 +++++++++++++++++++ rally/common/db/api.py | 2 +- rally/common/db/sqlalchemy/api.py | 2 +- rally/common/logging.py | 3 +- rally/common/opts.py | 3 +- rally/plugins/openstack/cfg/cinder.py | 2 +- rally/plugins/openstack/cfg/cleanup.py | 2 +- rally/plugins/openstack/cfg/ec2.py | 2 +- rally/plugins/openstack/cfg/glance.py | 2 +- rally/plugins/openstack/cfg/heat.py | 2 +- rally/plugins/openstack/cfg/ironic.py | 2 +- rally/plugins/openstack/cfg/keystone_roles.py | 2 +- rally/plugins/openstack/cfg/keystone_users.py | 2 +- rally/plugins/openstack/cfg/magnum.py | 2 +- rally/plugins/openstack/cfg/manila.py | 2 +- rally/plugins/openstack/cfg/mistral.py | 2 +- rally/plugins/openstack/cfg/monasca.py | 2 +- rally/plugins/openstack/cfg/murano.py | 2 +- rally/plugins/openstack/cfg/neutron.py | 2 +- rally/plugins/openstack/cfg/nova.py | 2 +- rally/plugins/openstack/cfg/osclients.py | 2 +- rally/plugins/openstack/cfg/profiler.py | 2 +- rally/plugins/openstack/cfg/sahara.py | 2 +- rally/plugins/openstack/cfg/senlin.py | 2 +- rally/plugins/openstack/cfg/tempest.py | 2 +- rally/plugins/openstack/cfg/vm.py | 2 +- rally/plugins/openstack/cfg/watcher.py | 2 +- rally/plugins/openstack/cleanup/base.py | 3 +- rally/plugins/openstack/cleanup/resources.py | 2 +- .../openstack/context/glance/images.py | 3 +- .../openstack/context/keystone/roles.py | 3 +- .../openstack/context/keystone/users.py | 3 +- .../manila/manila_security_services.py | 3 +- .../context/manila/manila_share_networks.py | 3 +- .../openstack/context/manila/manila_shares.py | 3 +- .../context/sahara/sahara_cluster.py | 3 +- rally/plugins/openstack/osclients.py | 2 +- rally/plugins/openstack/platforms/existing.py | 3 +- rally/plugins/openstack/scenario.py | 3 +- .../openstack/scenarios/cinder/utils.py | 3 +- .../plugins/openstack/scenarios/ec2/utils.py | 3 +- .../openstack/scenarios/glance/utils.py | 3 +- .../plugins/openstack/scenarios/heat/utils.py | 2 +- .../openstack/scenarios/ironic/utils.py | 3 +- .../openstack/scenarios/magnum/utils.py | 4 +- .../openstack/scenarios/manila/utils.py | 3 +- .../openstack/scenarios/mistral/utils.py | 2 +- .../openstack/scenarios/monasca/utils.py | 3 +- .../openstack/scenarios/murano/utils.py | 2 +- .../openstack/scenarios/neutron/utils.py | 3 +- .../plugins/openstack/scenarios/nova/utils.py | 3 +- .../openstack/scenarios/sahara/utils.py | 2 +- .../openstack/scenarios/senlin/utils.py | 3 +- rally/plugins/openstack/scenarios/vm/utils.py | 2 +- .../openstack/scenarios/watcher/utils.py | 3 +- rally/plugins/openstack/services/heat/main.py | 3 +- .../openstack/services/image/glance_v1.py | 3 +- .../openstack/services/image/glance_v2.py | 2 +- .../plugins/openstack/services/image/image.py | 2 +- .../openstack/services/storage/block.py | 3 +- .../openstack/verification/tempest/config.py | 2 +- rally/plugins/openstack/wrappers/glance.py | 9 +-- rally/plugins/openstack/wrappers/network.py | 2 +- rally/task/context.py | 2 +- rally/task/engine.py | 2 +- rally/task/scenario.py | 4 +- tests/hacking/checks.py | 23 ++++++- tests/unit/cli/test_cliutils.py | 2 +- tests/unit/common/db/test_migrations_base.py | 2 +- .../context/sahara/test_sahara_cluster.py | 2 +- .../openstack/scenarios/cinder/test_utils.py | 2 +- .../openstack/scenarios/ec2/test_utils.py | 2 +- .../openstack/scenarios/murano/test_utils.py | 2 +- .../openstack/scenarios/nova/test_utils.py | 2 +- .../openstack/scenarios/sahara/test_jobs.py | 2 +- .../openstack/scenarios/sahara/test_utils.py | 2 +- .../openstack/scenarios/senlin/test_utils.py | 2 +- .../openstack/scenarios/vm/test_utils.py | 2 +- .../openstack/scenarios/watcher/test_utils.py | 2 +- .../services/storage/test_cinder_common.py | 2 +- .../services/storage/test_cinder_v1.py | 2 +- .../services/storage/test_cinder_v2.py | 2 +- .../unit/plugins/openstack/test_osclients.py | 2 +- .../verification/tempest/test_config.py | 2 +- .../verification/tempest/test_context.py | 2 +- .../plugins/openstack/wrappers/test_glance.py | 2 +- tests/unit/test.py | 4 +- tests/unit/test_api.py | 2 +- 92 files changed, 186 insertions(+), 122 deletions(-) create mode 100644 rally/common/cfg.py diff --git a/etc/rally/rally.conf.sample b/etc/rally/rally.conf.sample index f567e4eff5..f6d2effe09 100644 --- a/etc/rally/rally.conf.sample +++ b/etc/rally/rally.conf.sample @@ -794,3 +794,8 @@ # Neutron create loadbalancer poll interval (floating point value) #neutron_create_loadbalancer_poll_interval = 2.0 + +# Whether Neutron API is older then OpenStack Newton or not. Based in +# this option, some external fields for identifying resources can be +# applied. (boolean value) +#pre_newton_neutron = false diff --git a/rally/api.py b/rally/api.py index 818f818f7b..eb498894d7 100644 --- a/rally/api.py +++ b/rally/api.py @@ -22,10 +22,10 @@ import time import jinja2 import jinja2.meta -from oslo_config import cfg import requests from requests.packages import urllib3 +from rally.common import cfg from rally.common import logging from rally.common import objects from rally.common import opts diff --git a/rally/cli/cliutils.py b/rally/cli/cliutils.py index a269e9a741..74b9c7b967 100644 --- a/rally/cli/cliutils.py +++ b/rally/cli/cliutils.py @@ -25,13 +25,13 @@ import warnings import decorator import jsonschema -from oslo_config import cfg from oslo_utils import encodeutils import prettytable import six import sqlalchemy.exc from rally import api +from rally.common import cfg from rally.common import logging from rally.common.plugin import info from rally import exceptions diff --git a/rally/cli/commands/db.py b/rally/cli/commands/db.py index 126dedac21..2860890ce5 100644 --- a/rally/cli/commands/db.py +++ b/rally/cli/commands/db.py @@ -17,10 +17,9 @@ from __future__ import print_function import re -from oslo_config import cfg - from rally.cli import cliutils from rally.cli import envutils +from rally.common import cfg from rally.common import db diff --git a/rally/common/cfg.py b/rally/common/cfg.py new file mode 100644 index 0000000000..c2aa653314 --- /dev/null +++ b/rally/common/cfg.py @@ -0,0 +1,63 @@ +# 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. + +# NOTE(andreykurilin): In near future we are planning to get rid of +# oslo_config. As a first step, let's hardcode the interface of it + +from oslo_config import cfg +from oslo_config import fixture # noqa + + +CONF = cfg.CONF +ConfigOpts = cfg.ConfigOpts + +find_config_dirs = cfg.find_config_dirs +find_config_files = cfg.find_config_files +set_defaults = cfg.set_defaults + +# exceptions +ArgsAlreadyParsedError = cfg.ArgsAlreadyParsedError +ConfigDirNotFoundError = cfg.ConfigDirNotFoundError +ConfigFileParseError = cfg.ConfigFileParseError +ConfigFileValueError = cfg.ConfigFileValueError +ConfigFilesNotFoundError = cfg.ConfigFilesNotFoundError +ConfigFilesPermissionDeniedError = cfg.ConfigFilesPermissionDeniedError +DefaultValueError = cfg.DefaultValueError +DuplicateOptError = cfg.DuplicateOptError +Error = cfg.Error +NoSuchGroupError = cfg.NoSuchGroupError +NoSuchOptError = cfg.NoSuchOptError +NotInitializedError = cfg.NotInitializedError +ParseError = cfg.ParseError +RequiredOptError = cfg.RequiredOptError +TemplateSubstitutionError = cfg.TemplateSubstitutionError + +# option types +Opt = cfg.Opt +OptGroup = cfg.OptGroup +BoolOpt = cfg.BoolOpt +DeprecatedOpt = cfg.DeprecatedOpt +DictOpt = cfg.DictOpt +FloatOpt = cfg.FloatOpt +HostAddressOpt = cfg.HostAddressOpt +HostnameOpt = cfg.HostnameOpt +IPOpt = cfg.IPOpt +IntOpt = cfg.IntOpt +ListOpt = cfg.ListOpt +MultiOpt = cfg.MultiOpt +MultiStrOpt = cfg.MultiStrOpt +PortOpt = cfg.PortOpt +StrOpt = cfg.StrOpt +SubCommandOpt = cfg.SubCommandOpt +URIOpt = cfg.URIOpt diff --git a/rally/common/db/api.py b/rally/common/db/api.py index 0c8b7e66ae..d6967582a9 100644 --- a/rally/common/db/api.py +++ b/rally/common/db/api.py @@ -40,10 +40,10 @@ these objects be simple dictionaries. """ -from oslo_config import cfg from oslo_db import api as db_api from oslo_db import options as db_options +from rally.common import cfg CONF = cfg.CONF diff --git a/rally/common/db/sqlalchemy/api.py b/rally/common/db/sqlalchemy/api.py index 92e39fe58f..6335f40a7a 100644 --- a/rally/common/db/sqlalchemy/api.py +++ b/rally/common/db/sqlalchemy/api.py @@ -25,13 +25,13 @@ import alembic from alembic import config as alembic_config import alembic.migration as alembic_migration from alembic import script as alembic_script -from oslo_config import cfg from oslo_db import exception as db_exc from oslo_db.sqlalchemy import session as db_session import six import sqlalchemy as sa import sqlalchemy.orm # noqa +from rally.common import cfg from rally.common.db.sqlalchemy import models from rally import consts from rally import exceptions diff --git a/rally/common/logging.py b/rally/common/logging.py index a44e7d1141..6ed3b9515e 100644 --- a/rally/common/logging.py +++ b/rally/common/logging.py @@ -16,11 +16,12 @@ import functools import traceback -from oslo_config import cfg from oslo_log import handlers from oslo_log import log as oslogging import six +from rally.common import cfg + log = __import__("logging") diff --git a/rally/common/opts.py b/rally/common/opts.py index bcb4512592..d0dab4e588 100644 --- a/rally/common/opts.py +++ b/rally/common/opts.py @@ -12,8 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.common import logging from rally.plugins.openstack.cfg import opts as openstack_opts from rally.task import engine diff --git a/rally/plugins/openstack/cfg/cinder.py b/rally/plugins/openstack/cfg/cinder.py index b87c474289..e1f0721763 100644 --- a/rally/plugins/openstack/cfg/cinder.py +++ b/rally/plugins/openstack/cfg/cinder.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt("cinder_volume_create_prepoll_delay", diff --git a/rally/plugins/openstack/cfg/cleanup.py b/rally/plugins/openstack/cfg/cleanup.py index 02c6029817..1a18bc2968 100644 --- a/rally/plugins/openstack/cfg/cleanup.py +++ b/rally/plugins/openstack/cfg/cleanup.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.IntOpt("resource_deletion_timeout", diff --git a/rally/plugins/openstack/cfg/ec2.py b/rally/plugins/openstack/cfg/ec2.py index 67d6e6dc65..b758027727 100644 --- a/rally/plugins/openstack/cfg/ec2.py +++ b/rally/plugins/openstack/cfg/ec2.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt( diff --git a/rally/plugins/openstack/cfg/glance.py b/rally/plugins/openstack/cfg/glance.py index 66c0e0a029..a6170f52ba 100644 --- a/rally/plugins/openstack/cfg/glance.py +++ b/rally/plugins/openstack/cfg/glance.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt("glance_image_delete_timeout", diff --git a/rally/plugins/openstack/cfg/heat.py b/rally/plugins/openstack/cfg/heat.py index 7cccda4953..b8979f4d8a 100644 --- a/rally/plugins/openstack/cfg/heat.py +++ b/rally/plugins/openstack/cfg/heat.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt("heat_stack_create_prepoll_delay", diff --git a/rally/plugins/openstack/cfg/ironic.py b/rally/plugins/openstack/cfg/ironic.py index 3fce98f8f7..a0f3c62a02 100644 --- a/rally/plugins/openstack/cfg/ironic.py +++ b/rally/plugins/openstack/cfg/ironic.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt("ironic_node_create_poll_interval", diff --git a/rally/plugins/openstack/cfg/keystone_roles.py b/rally/plugins/openstack/cfg/keystone_roles.py index 785dbdc8de..474816318b 100644 --- a/rally/plugins/openstack/cfg/keystone_roles.py +++ b/rally/plugins/openstack/cfg/keystone_roles.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.IntOpt("roles_context_resource_management_workers", diff --git a/rally/plugins/openstack/cfg/keystone_users.py b/rally/plugins/openstack/cfg/keystone_users.py index 5a67ff7344..1a88aa7343 100644 --- a/rally/plugins/openstack/cfg/keystone_users.py +++ b/rally/plugins/openstack/cfg/keystone_users.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ diff --git a/rally/plugins/openstack/cfg/magnum.py b/rally/plugins/openstack/cfg/magnum.py index 6915317ba2..174bd683c9 100644 --- a/rally/plugins/openstack/cfg/magnum.py +++ b/rally/plugins/openstack/cfg/magnum.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt("magnum_cluster_create_prepoll_delay", diff --git a/rally/plugins/openstack/cfg/manila.py b/rally/plugins/openstack/cfg/manila.py index 0712ee4a34..86614dcad6 100644 --- a/rally/plugins/openstack/cfg/manila.py +++ b/rally/plugins/openstack/cfg/manila.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt( diff --git a/rally/plugins/openstack/cfg/mistral.py b/rally/plugins/openstack/cfg/mistral.py index 5202aef465..6c5abdb106 100644 --- a/rally/plugins/openstack/cfg/mistral.py +++ b/rally/plugins/openstack/cfg/mistral.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.IntOpt( diff --git a/rally/plugins/openstack/cfg/monasca.py b/rally/plugins/openstack/cfg/monasca.py index 46ea4acbeb..0f461ee035 100644 --- a/rally/plugins/openstack/cfg/monasca.py +++ b/rally/plugins/openstack/cfg/monasca.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt( diff --git a/rally/plugins/openstack/cfg/murano.py b/rally/plugins/openstack/cfg/murano.py index 52c2731b7c..965167f19c 100644 --- a/rally/plugins/openstack/cfg/murano.py +++ b/rally/plugins/openstack/cfg/murano.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.IntOpt("murano_deploy_environment_timeout", diff --git a/rally/plugins/openstack/cfg/neutron.py b/rally/plugins/openstack/cfg/neutron.py index eba3ef3ca7..ad7dc2f36b 100644 --- a/rally/plugins/openstack/cfg/neutron.py +++ b/rally/plugins/openstack/cfg/neutron.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt("neutron_create_loadbalancer_timeout", diff --git a/rally/plugins/openstack/cfg/nova.py b/rally/plugins/openstack/cfg/nova.py index 39f23d67bd..23269fbfa2 100644 --- a/rally/plugins/openstack/cfg/nova.py +++ b/rally/plugins/openstack/cfg/nova.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ # prepoll delay, timeout, poll interval diff --git a/rally/plugins/openstack/cfg/osclients.py b/rally/plugins/openstack/cfg/osclients.py index 05b58862e9..ce9ab0ffdc 100644 --- a/rally/plugins/openstack/cfg/osclients.py +++ b/rally/plugins/openstack/cfg/osclients.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = { diff --git a/rally/plugins/openstack/cfg/profiler.py b/rally/plugins/openstack/cfg/profiler.py index a87555beb1..06362cbdbf 100644 --- a/rally/plugins/openstack/cfg/profiler.py +++ b/rally/plugins/openstack/cfg/profiler.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.BoolOpt("enable_profiler", diff --git a/rally/plugins/openstack/cfg/sahara.py b/rally/plugins/openstack/cfg/sahara.py index 51e1712215..4123fea863 100644 --- a/rally/plugins/openstack/cfg/sahara.py +++ b/rally/plugins/openstack/cfg/sahara.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.IntOpt("sahara_cluster_create_timeout", diff --git a/rally/plugins/openstack/cfg/senlin.py b/rally/plugins/openstack/cfg/senlin.py index 58287ff8fc..e5490e1c1e 100644 --- a/rally/plugins/openstack/cfg/senlin.py +++ b/rally/plugins/openstack/cfg/senlin.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt("senlin_action_timeout", diff --git a/rally/plugins/openstack/cfg/tempest.py b/rally/plugins/openstack/cfg/tempest.py index 2c6c693b27..9806b16b03 100644 --- a/rally/plugins/openstack/cfg/tempest.py +++ b/rally/plugins/openstack/cfg/tempest.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.StrOpt("img_url", diff --git a/rally/plugins/openstack/cfg/vm.py b/rally/plugins/openstack/cfg/vm.py index 1fa5c008b6..8fb6f2143a 100644 --- a/rally/plugins/openstack/cfg/vm.py +++ b/rally/plugins/openstack/cfg/vm.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt("vm_ping_poll_interval", diff --git a/rally/plugins/openstack/cfg/watcher.py b/rally/plugins/openstack/cfg/watcher.py index f608271425..615bf1b144 100644 --- a/rally/plugins/openstack/cfg/watcher.py +++ b/rally/plugins/openstack/cfg/watcher.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg +from rally.common import cfg OPTS = {"openstack": [ cfg.FloatOpt("watcher_audit_launch_poll_interval", diff --git a/rally/plugins/openstack/cleanup/base.py b/rally/plugins/openstack/cleanup/base.py index 0bb3a94605..7623058d94 100644 --- a/rally/plugins/openstack/cleanup/base.py +++ b/rally/plugins/openstack/cleanup/base.py @@ -14,8 +14,7 @@ # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.task import utils CONF = cfg.CONF diff --git a/rally/plugins/openstack/cleanup/resources.py b/rally/plugins/openstack/cleanup/resources.py index 170b8feb53..b0d62e3c36 100644 --- a/rally/plugins/openstack/cleanup/resources.py +++ b/rally/plugins/openstack/cleanup/resources.py @@ -16,9 +16,9 @@ from boto import exception as boto_exception from neutronclient.common import exceptions as neutron_exceptions from novaclient import exceptions as nova_exc -from oslo_config import cfg from saharaclient.api import base as saharaclient_base +from rally.common import cfg from rally.common import logging from rally.plugins.openstack.cleanup import base from rally.plugins.openstack.services.identity import identity diff --git a/rally/plugins/openstack/context/glance/images.py b/rally/plugins/openstack/context/glance/images.py index 53d2c7afdf..95e26f1449 100644 --- a/rally/plugins/openstack/context/glance/images.py +++ b/rally/plugins/openstack/context/glance/images.py @@ -12,8 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.common import logging from rally.common import utils as rutils from rally.common import validation diff --git a/rally/plugins/openstack/context/keystone/roles.py b/rally/plugins/openstack/context/keystone/roles.py index 69fd83c001..9c51670398 100644 --- a/rally/plugins/openstack/context/keystone/roles.py +++ b/rally/plugins/openstack/context/keystone/roles.py @@ -13,9 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - from rally.common import broker +from rally.common import cfg from rally.common import logging from rally.common import validation from rally import consts diff --git a/rally/plugins/openstack/context/keystone/users.py b/rally/plugins/openstack/context/keystone/users.py index 283fd6116b..073ba19d82 100644 --- a/rally/plugins/openstack/context/keystone/users.py +++ b/rally/plugins/openstack/context/keystone/users.py @@ -16,9 +16,8 @@ import collections import uuid -from oslo_config import cfg - from rally.common import broker +from rally.common import cfg from rally.common import logging from rally.common import utils as rutils from rally.common import validation diff --git a/rally/plugins/openstack/context/manila/manila_security_services.py b/rally/plugins/openstack/context/manila/manila_security_services.py index 905d00d2b9..adabcc138a 100644 --- a/rally/plugins/openstack/context/manila/manila_security_services.py +++ b/rally/plugins/openstack/context/manila/manila_security_services.py @@ -13,8 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.common import utils from rally.common import validation from rally import consts as rally_consts diff --git a/rally/plugins/openstack/context/manila/manila_share_networks.py b/rally/plugins/openstack/context/manila/manila_share_networks.py index dafa5350c7..ef15d5275a 100644 --- a/rally/plugins/openstack/context/manila/manila_share_networks.py +++ b/rally/plugins/openstack/context/manila/manila_share_networks.py @@ -13,8 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.common import logging from rally.common import utils from rally.common import validation diff --git a/rally/plugins/openstack/context/manila/manila_shares.py b/rally/plugins/openstack/context/manila/manila_shares.py index 654ab761be..fe9b59f77a 100644 --- a/rally/plugins/openstack/context/manila/manila_shares.py +++ b/rally/plugins/openstack/context/manila/manila_shares.py @@ -13,8 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.common import utils from rally.common import validation from rally import consts as rally_consts diff --git a/rally/plugins/openstack/context/sahara/sahara_cluster.py b/rally/plugins/openstack/context/sahara/sahara_cluster.py index f75ec3e0ed..9e28845161 100644 --- a/rally/plugins/openstack/context/sahara/sahara_cluster.py +++ b/rally/plugins/openstack/context/sahara/sahara_cluster.py @@ -13,8 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.common import utils as rutils from rally.common import validation from rally import consts diff --git a/rally/plugins/openstack/osclients.py b/rally/plugins/openstack/osclients.py index a68510317d..c781258d69 100644 --- a/rally/plugins/openstack/osclients.py +++ b/rally/plugins/openstack/osclients.py @@ -16,10 +16,10 @@ import abc import os -from oslo_config import cfg from six.moves.urllib import parse from rally.cli import envutils +from rally.common import cfg from rally.common import logging from rally.common.plugin import plugin from rally.common import utils diff --git a/rally/plugins/openstack/platforms/existing.py b/rally/plugins/openstack/platforms/existing.py index a84f6c94a2..71c7bef6b6 100644 --- a/rally/plugins/openstack/platforms/existing.py +++ b/rally/plugins/openstack/platforms/existing.py @@ -16,8 +16,7 @@ import copy import json import traceback -from oslo_config import cfg - +from rally.common import cfg from rally.common import logging from rally.env import platform from rally.plugins.openstack import osclients diff --git a/rally/plugins/openstack/scenario.py b/rally/plugins/openstack/scenario.py index 1da63e8d28..ad1c36c304 100644 --- a/rally/plugins/openstack/scenario.py +++ b/rally/plugins/openstack/scenario.py @@ -16,8 +16,9 @@ import functools import random -from oslo_config import cfg from osprofiler import profiler + +from rally.common import cfg from rally.common.plugin import plugin from rally.plugins.openstack import osclients from rally.task import context diff --git a/rally/plugins/openstack/scenarios/cinder/utils.py b/rally/plugins/openstack/scenarios/cinder/utils.py index 662f23f46d..7e2c4f87d2 100644 --- a/rally/plugins/openstack/scenarios/cinder/utils.py +++ b/rally/plugins/openstack/scenarios/cinder/utils.py @@ -15,8 +15,7 @@ import random -from oslo_config import cfg - +from rally.common import cfg from rally.common import logging from rally import exceptions from rally.plugins.openstack import scenario diff --git a/rally/plugins/openstack/scenarios/ec2/utils.py b/rally/plugins/openstack/scenarios/ec2/utils.py index da661b6c24..70d60da334 100644 --- a/rally/plugins/openstack/scenarios/ec2/utils.py +++ b/rally/plugins/openstack/scenarios/ec2/utils.py @@ -13,8 +13,7 @@ # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.plugins.openstack import scenario from rally.task import atomic from rally.task import utils diff --git a/rally/plugins/openstack/scenarios/glance/utils.py b/rally/plugins/openstack/scenarios/glance/utils.py index fc2ed5a3e0..1c10af683a 100644 --- a/rally/plugins/openstack/scenarios/glance/utils.py +++ b/rally/plugins/openstack/scenarios/glance/utils.py @@ -13,8 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.common import logging from rally.plugins.openstack import scenario from rally.plugins.openstack.wrappers import glance as glance_wrapper diff --git a/rally/plugins/openstack/scenarios/heat/utils.py b/rally/plugins/openstack/scenarios/heat/utils.py index 7d6184c0ee..5f083f4606 100644 --- a/rally/plugins/openstack/scenarios/heat/utils.py +++ b/rally/plugins/openstack/scenarios/heat/utils.py @@ -13,9 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg import requests +from rally.common import cfg from rally.common import logging from rally import exceptions from rally.plugins.openstack import scenario diff --git a/rally/plugins/openstack/scenarios/ironic/utils.py b/rally/plugins/openstack/scenarios/ironic/utils.py index 8e09ba31b2..ae45893ae4 100644 --- a/rally/plugins/openstack/scenarios/ironic/utils.py +++ b/rally/plugins/openstack/scenarios/ironic/utils.py @@ -15,8 +15,7 @@ import string -from oslo_config import cfg - +from rally.common import cfg from rally.plugins.openstack import scenario from rally.task import atomic from rally.task import utils diff --git a/rally/plugins/openstack/scenarios/magnum/utils.py b/rally/plugins/openstack/scenarios/magnum/utils.py index 64947221f2..d1e76d7f80 100644 --- a/rally/plugins/openstack/scenarios/magnum/utils.py +++ b/rally/plugins/openstack/scenarios/magnum/utils.py @@ -17,12 +17,12 @@ import random import string import time -from oslo_config import cfg - from kubernetes import client as k8s_config from kubernetes.client import api_client from kubernetes.client.apis import core_v1_api from kubernetes.client.rest import ApiException + +from rally.common import cfg from rally.common import utils as common_utils from rally import exceptions from rally.plugins.openstack import scenario diff --git a/rally/plugins/openstack/scenarios/manila/utils.py b/rally/plugins/openstack/scenarios/manila/utils.py index 555795f168..73b00c75f1 100644 --- a/rally/plugins/openstack/scenarios/manila/utils.py +++ b/rally/plugins/openstack/scenarios/manila/utils.py @@ -15,8 +15,7 @@ import random -from oslo_config import cfg - +from rally.common import cfg from rally import exceptions from rally.plugins.openstack.context.manila import consts from rally.plugins.openstack import scenario diff --git a/rally/plugins/openstack/scenarios/mistral/utils.py b/rally/plugins/openstack/scenarios/mistral/utils.py index aff1b1bf21..147c414cee 100644 --- a/rally/plugins/openstack/scenarios/mistral/utils.py +++ b/rally/plugins/openstack/scenarios/mistral/utils.py @@ -14,9 +14,9 @@ # under the License. -from oslo_config import cfg import yaml +from rally.common import cfg from rally.plugins.openstack import scenario from rally.task import atomic from rally.task import utils diff --git a/rally/plugins/openstack/scenarios/monasca/utils.py b/rally/plugins/openstack/scenarios/monasca/utils.py index 6d5e1930a9..8b609a1100 100644 --- a/rally/plugins/openstack/scenarios/monasca/utils.py +++ b/rally/plugins/openstack/scenarios/monasca/utils.py @@ -16,8 +16,7 @@ import random import time import uuid -from oslo_config import cfg - +from rally.common import cfg from rally.plugins.openstack import scenario from rally.task import atomic diff --git a/rally/plugins/openstack/scenarios/murano/utils.py b/rally/plugins/openstack/scenarios/murano/utils.py index 49d7c01fa5..84ca3c5f91 100644 --- a/rally/plugins/openstack/scenarios/murano/utils.py +++ b/rally/plugins/openstack/scenarios/murano/utils.py @@ -19,9 +19,9 @@ import tempfile import uuid import zipfile -from oslo_config import cfg import yaml +from rally.common import cfg from rally.common import fileutils from rally.common import utils as common_utils from rally.plugins.openstack import scenario diff --git a/rally/plugins/openstack/scenarios/neutron/utils.py b/rally/plugins/openstack/scenarios/neutron/utils.py index ca3e29b355..e0532e2f9d 100644 --- a/rally/plugins/openstack/scenarios/neutron/utils.py +++ b/rally/plugins/openstack/scenarios/neutron/utils.py @@ -15,8 +15,7 @@ import random -from oslo_config import cfg - +from rally.common import cfg from rally.common import logging from rally import exceptions from rally.plugins.openstack import scenario diff --git a/rally/plugins/openstack/scenarios/nova/utils.py b/rally/plugins/openstack/scenarios/nova/utils.py index 0ae03964ff..40bec27a27 100644 --- a/rally/plugins/openstack/scenarios/nova/utils.py +++ b/rally/plugins/openstack/scenarios/nova/utils.py @@ -14,8 +14,7 @@ # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.common import logging from rally import exceptions from rally.plugins.openstack import scenario diff --git a/rally/plugins/openstack/scenarios/sahara/utils.py b/rally/plugins/openstack/scenarios/sahara/utils.py index 7ad8d5caff..4ca8e408ca 100644 --- a/rally/plugins/openstack/scenarios/sahara/utils.py +++ b/rally/plugins/openstack/scenarios/sahara/utils.py @@ -15,10 +15,10 @@ import random -from oslo_config import cfg from oslo_utils import uuidutils from saharaclient.api import base as sahara_base +from rally.common import cfg from rally.common import logging from rally.common import utils as rutils from rally import consts diff --git a/rally/plugins/openstack/scenarios/senlin/utils.py b/rally/plugins/openstack/scenarios/senlin/utils.py index 12d1d866f0..fd905fbe69 100644 --- a/rally/plugins/openstack/scenarios/senlin/utils.py +++ b/rally/plugins/openstack/scenarios/senlin/utils.py @@ -10,8 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally import exceptions from rally.plugins.openstack import scenario from rally.task import atomic diff --git a/rally/plugins/openstack/scenarios/vm/utils.py b/rally/plugins/openstack/scenarios/vm/utils.py index 44537a1b18..536bc0ee19 100644 --- a/rally/plugins/openstack/scenarios/vm/utils.py +++ b/rally/plugins/openstack/scenarios/vm/utils.py @@ -18,9 +18,9 @@ import subprocess import sys import netaddr -from oslo_config import cfg import six +from rally.common import cfg from rally.common import logging from rally.common import sshutils from rally.plugins.openstack.scenarios.nova import utils as nova_utils diff --git a/rally/plugins/openstack/scenarios/watcher/utils.py b/rally/plugins/openstack/scenarios/watcher/utils.py index 51b86c960f..ce29d3e7e8 100644 --- a/rally/plugins/openstack/scenarios/watcher/utils.py +++ b/rally/plugins/openstack/scenarios/watcher/utils.py @@ -10,8 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.plugins.openstack import scenario from rally.task import atomic from rally.task import utils diff --git a/rally/plugins/openstack/services/heat/main.py b/rally/plugins/openstack/services/heat/main.py index 75b97d4dad..af2c429be7 100644 --- a/rally/plugins/openstack/services/heat/main.py +++ b/rally/plugins/openstack/services/heat/main.py @@ -11,8 +11,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.common import utils as common_utils from rally.task import atomic from rally.task import utils diff --git a/rally/plugins/openstack/services/image/glance_v1.py b/rally/plugins/openstack/services/image/glance_v1.py index d0d4b13aef..a7f979ed94 100644 --- a/rally/plugins/openstack/services/image/glance_v1.py +++ b/rally/plugins/openstack/services/image/glance_v1.py @@ -14,8 +14,7 @@ import os -from oslo_config import cfg - +from rally.common import cfg from rally.common import utils as rutils from rally.plugins.openstack import service from rally.plugins.openstack.services.image import glance_common diff --git a/rally/plugins/openstack/services/image/glance_v2.py b/rally/plugins/openstack/services/image/glance_v2.py index fcd4d0d0c2..575e2c36d9 100644 --- a/rally/plugins/openstack/services/image/glance_v2.py +++ b/rally/plugins/openstack/services/image/glance_v2.py @@ -15,9 +15,9 @@ import os import time -from oslo_config import cfg import requests +from rally.common import cfg from rally.common import utils as rutils from rally.plugins.openstack import service from rally.plugins.openstack.services.image import glance_common diff --git a/rally/plugins/openstack/services/image/image.py b/rally/plugins/openstack/services/image/image.py index b58f3da264..86a940af31 100644 --- a/rally/plugins/openstack/services/image/image.py +++ b/rally/plugins/openstack/services/image/image.py @@ -11,10 +11,10 @@ # License for the specific language governing permissions and limitations # under the License. +from rally.common import cfg from rally import exceptions from rally.task import service -from oslo_config import cfg CONF = cfg.CONF diff --git a/rally/plugins/openstack/services/storage/block.py b/rally/plugins/openstack/services/storage/block.py index 9263790d93..8a74fde089 100644 --- a/rally/plugins/openstack/services/storage/block.py +++ b/rally/plugins/openstack/services/storage/block.py @@ -12,8 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - +from rally.common import cfg from rally.task import service diff --git a/rally/plugins/openstack/verification/tempest/config.py b/rally/plugins/openstack/verification/tempest/config.py index 8f090ac49a..4bf083877d 100644 --- a/rally/plugins/openstack/verification/tempest/config.py +++ b/rally/plugins/openstack/verification/tempest/config.py @@ -16,10 +16,10 @@ import inspect import os -from oslo_config import cfg import six from six.moves import configparser +from rally.common import cfg from rally.common import logging from rally import exceptions from rally.verification import utils diff --git a/rally/plugins/openstack/wrappers/glance.py b/rally/plugins/openstack/wrappers/glance.py index 271224b79f..b0c70533c3 100644 --- a/rally/plugins/openstack/wrappers/glance.py +++ b/rally/plugins/openstack/wrappers/glance.py @@ -17,15 +17,16 @@ import abc import os import time +from glanceclient import exc as glance_exc +import requests +import six + +from rally.common import cfg from rally.common import logging from rally.common import utils as rutils from rally import exceptions from rally.task import utils -from glanceclient import exc as glance_exc -from oslo_config import cfg -import requests -import six LOG = logging.getLogger(__name__) diff --git a/rally/plugins/openstack/wrappers/network.py b/rally/plugins/openstack/wrappers/network.py index f8382609ef..fe14ce2b54 100644 --- a/rally/plugins/openstack/wrappers/network.py +++ b/rally/plugins/openstack/wrappers/network.py @@ -16,9 +16,9 @@ import abc import netaddr -from oslo_config import cfg import six +from rally.common import cfg from rally.common import logging from rally.common import utils from rally import consts diff --git a/rally/task/context.py b/rally/task/context.py index e82f6d007f..37be5243c2 100644 --- a/rally/task/context.py +++ b/rally/task/context.py @@ -16,9 +16,9 @@ import abc import collections -from oslo_config import cfg import six +from rally.common import cfg from rally.common import logging from rally.common.plugin import plugin from rally.common import utils diff --git a/rally/task/engine.py b/rally/task/engine.py index 44e3475b02..222cd85a16 100644 --- a/rally/task/engine.py +++ b/rally/task/engine.py @@ -20,8 +20,8 @@ import time import traceback import jsonschema -from oslo_config import cfg +from rally.common import cfg from rally.common import logging from rally.common import objects from rally.common import utils diff --git a/rally/task/scenario.py b/rally/task/scenario.py index 93f2a5f82d..208a45d7a1 100644 --- a/rally/task/scenario.py +++ b/rally/task/scenario.py @@ -16,10 +16,8 @@ import copy import random -from oslo_config import cfg - +from rally.common import cfg from rally.common import logging -from rally.common.objects import task # noqa from rally.common.plugin import plugin from rally.common import utils from rally.common import validation diff --git a/tests/hacking/checks.py b/tests/hacking/checks.py index eb34924926..b940893740 100644 --- a/tests/hacking/checks.py +++ b/tests/hacking/checks.py @@ -177,6 +177,25 @@ def check_import_of_logging(logical_line, physical_line, filename): "use `rally.common.logging` instead.") +@skip_ignored_lines +def check_import_of_config(logical_line, physical_line, filename): + """Check correctness import of config module + + N311 + """ + + excluded_files = ["./rally/common/cfg.py"] + + forbidden_imports = ["from oslo_config", + "import oslo_config"] + + if filename not in excluded_files: + for forbidden_import in forbidden_imports: + if logical_line.startswith(forbidden_import): + yield (0, "N311 Wrong module for config is imported. Please " + "use `rally.common.cfg` instead.") + + @skip_ignored_lines def no_use_conf_debug_check(logical_line, physical_line, filename): """Check for "cfg.CONF.debug" @@ -572,8 +591,7 @@ def check_opts_import_path(logical_line, physical_line, filename): N342 """ - excluded_files = ["./rally/osclients.py", - "./rally/task/engine.py", + excluded_files = ["./rally/task/engine.py", "./rally/task/context.py", "./rally/task/scenario.py", "./rally/common/opts.py"] @@ -590,6 +608,7 @@ def check_opts_import_path(logical_line, physical_line, filename): def factory(register): register(check_assert_methods_from_mock) register(check_import_of_logging) + register(check_import_of_config) register(no_use_conf_debug_check) register(assert_true_instance) register(assert_equal_type) diff --git a/tests/unit/cli/test_cliutils.py b/tests/unit/cli/test_cliutils.py index 615e82e3c0..d374978e48 100644 --- a/tests/unit/cli/test_cliutils.py +++ b/tests/unit/cli/test_cliutils.py @@ -16,7 +16,6 @@ import ddt from keystoneclient import exceptions as keystone_exc import mock -from oslo_config import cfg import six import sqlalchemy.exc @@ -24,6 +23,7 @@ from rally.cli import cliutils from rally.cli.commands import deployment from rally.cli.commands import task from rally.cli.commands import verify +from rally.common import cfg from rally import exceptions from tests.unit import test diff --git a/tests/unit/common/db/test_migrations_base.py b/tests/unit/common/db/test_migrations_base.py index c41f14398c..c9b9ec9de3 100644 --- a/tests/unit/common/db/test_migrations_base.py +++ b/tests/unit/common/db/test_migrations_base.py @@ -28,8 +28,8 @@ from alembic import command from alembic import config as alembic_config from alembic import migration from alembic import script as alembic_script -from oslo_config import cfg +from rally.common import cfg import rally.common.db.sqlalchemy.api as s_api from rally.common import logging diff --git a/tests/unit/plugins/openstack/context/sahara/test_sahara_cluster.py b/tests/unit/plugins/openstack/context/sahara/test_sahara_cluster.py index ff2d5c150f..3ed20e490c 100644 --- a/tests/unit/plugins/openstack/context/sahara/test_sahara_cluster.py +++ b/tests/unit/plugins/openstack/context/sahara/test_sahara_cluster.py @@ -13,8 +13,8 @@ # under the License. import mock -from oslo_config import cfg +from rally.common import cfg from rally import exceptions from rally.plugins.openstack.context.sahara import sahara_cluster from rally.plugins.openstack.scenarios.sahara import utils as sahara_utils diff --git a/tests/unit/plugins/openstack/scenarios/cinder/test_utils.py b/tests/unit/plugins/openstack/scenarios/cinder/test_utils.py index 576f584fa4..63d4f7b10f 100644 --- a/tests/unit/plugins/openstack/scenarios/cinder/test_utils.py +++ b/tests/unit/plugins/openstack/scenarios/cinder/test_utils.py @@ -14,8 +14,8 @@ # under the License. import mock -from oslo_config import cfg +from rally.common import cfg from rally import exceptions from rally.plugins.openstack import osclients from rally.plugins.openstack.scenarios.cinder import utils diff --git a/tests/unit/plugins/openstack/scenarios/ec2/test_utils.py b/tests/unit/plugins/openstack/scenarios/ec2/test_utils.py index e988f9bb84..69a241bff8 100644 --- a/tests/unit/plugins/openstack/scenarios/ec2/test_utils.py +++ b/tests/unit/plugins/openstack/scenarios/ec2/test_utils.py @@ -13,8 +13,8 @@ # under the License. import mock -from oslo_config import cfg +from rally.common import cfg from rally.plugins.openstack.scenarios.ec2 import utils from tests.unit import test diff --git a/tests/unit/plugins/openstack/scenarios/murano/test_utils.py b/tests/unit/plugins/openstack/scenarios/murano/test_utils.py index 6917ed1e5a..311dd69c70 100644 --- a/tests/unit/plugins/openstack/scenarios/murano/test_utils.py +++ b/tests/unit/plugins/openstack/scenarios/murano/test_utils.py @@ -14,8 +14,8 @@ # under the License. import mock -from oslo_config import cfg +from rally.common import cfg from rally.plugins.openstack.scenarios.murano import utils from tests.unit import test diff --git a/tests/unit/plugins/openstack/scenarios/nova/test_utils.py b/tests/unit/plugins/openstack/scenarios/nova/test_utils.py index 9aae02e424..6c5257e3d0 100644 --- a/tests/unit/plugins/openstack/scenarios/nova/test_utils.py +++ b/tests/unit/plugins/openstack/scenarios/nova/test_utils.py @@ -15,8 +15,8 @@ import ddt import mock -from oslo_config import cfg +from rally.common import cfg from rally import exceptions as rally_exceptions from rally.plugins.openstack.scenarios.nova import utils from tests.unit import fakes diff --git a/tests/unit/plugins/openstack/scenarios/sahara/test_jobs.py b/tests/unit/plugins/openstack/scenarios/sahara/test_jobs.py index 340f75e119..ae0552c78c 100644 --- a/tests/unit/plugins/openstack/scenarios/sahara/test_jobs.py +++ b/tests/unit/plugins/openstack/scenarios/sahara/test_jobs.py @@ -14,8 +14,8 @@ # under the License. import mock -from oslo_config import cfg +from rally.common import cfg from rally.plugins.openstack.scenarios.sahara import jobs from tests.unit import test diff --git a/tests/unit/plugins/openstack/scenarios/sahara/test_utils.py b/tests/unit/plugins/openstack/scenarios/sahara/test_utils.py index 10e818c4fe..65b850706e 100644 --- a/tests/unit/plugins/openstack/scenarios/sahara/test_utils.py +++ b/tests/unit/plugins/openstack/scenarios/sahara/test_utils.py @@ -14,10 +14,10 @@ # under the License. import mock -from oslo_config import cfg from oslo_utils import uuidutils from saharaclient.api import base as sahara_base +from rally.common import cfg from rally import consts from rally import exceptions from rally.plugins.openstack.scenarios.sahara import utils diff --git a/tests/unit/plugins/openstack/scenarios/senlin/test_utils.py b/tests/unit/plugins/openstack/scenarios/senlin/test_utils.py index 4fd020d3c3..5ca9c86cc9 100644 --- a/tests/unit/plugins/openstack/scenarios/senlin/test_utils.py +++ b/tests/unit/plugins/openstack/scenarios/senlin/test_utils.py @@ -11,8 +11,8 @@ # under the License. import mock -from oslo_config import cfg +from rally.common import cfg from rally import exceptions from rally.plugins.openstack.scenarios.senlin import utils from tests.unit import test diff --git a/tests/unit/plugins/openstack/scenarios/vm/test_utils.py b/tests/unit/plugins/openstack/scenarios/vm/test_utils.py index 69f149b5d6..ee8bd74394 100644 --- a/tests/unit/plugins/openstack/scenarios/vm/test_utils.py +++ b/tests/unit/plugins/openstack/scenarios/vm/test_utils.py @@ -18,8 +18,8 @@ import subprocess import mock import netaddr -from oslo_config import cfg +from rally.common import cfg from rally.plugins.openstack.scenarios.vm import utils from tests.unit import test diff --git a/tests/unit/plugins/openstack/scenarios/watcher/test_utils.py b/tests/unit/plugins/openstack/scenarios/watcher/test_utils.py index 2bbc982345..6e3dc3b3bd 100644 --- a/tests/unit/plugins/openstack/scenarios/watcher/test_utils.py +++ b/tests/unit/plugins/openstack/scenarios/watcher/test_utils.py @@ -14,8 +14,8 @@ # under the License. import mock -from oslo_config import cfg +from rally.common import cfg from rally.plugins.openstack.scenarios.watcher import utils from tests.unit import test diff --git a/tests/unit/plugins/openstack/services/storage/test_cinder_common.py b/tests/unit/plugins/openstack/services/storage/test_cinder_common.py index 8ecdcaed43..b66e70e243 100644 --- a/tests/unit/plugins/openstack/services/storage/test_cinder_common.py +++ b/tests/unit/plugins/openstack/services/storage/test_cinder_common.py @@ -16,8 +16,8 @@ import uuid import ddt import mock -from oslo_config import cfg +from rally.common import cfg from rally import exceptions from rally.plugins.openstack import service from rally.plugins.openstack.services.storage import block diff --git a/tests/unit/plugins/openstack/services/storage/test_cinder_v1.py b/tests/unit/plugins/openstack/services/storage/test_cinder_v1.py index 7c0ace2736..b2a13027c5 100644 --- a/tests/unit/plugins/openstack/services/storage/test_cinder_v1.py +++ b/tests/unit/plugins/openstack/services/storage/test_cinder_v1.py @@ -13,8 +13,8 @@ # under the License. import mock -from oslo_config import cfg +from rally.common import cfg from rally.plugins.openstack.services.storage import cinder_v1 from tests.unit import fakes from tests.unit import test diff --git a/tests/unit/plugins/openstack/services/storage/test_cinder_v2.py b/tests/unit/plugins/openstack/services/storage/test_cinder_v2.py index c34c962c9f..c3857f29d7 100644 --- a/tests/unit/plugins/openstack/services/storage/test_cinder_v2.py +++ b/tests/unit/plugins/openstack/services/storage/test_cinder_v2.py @@ -13,8 +13,8 @@ # under the License. import mock -from oslo_config import cfg +from rally.common import cfg from rally.plugins.openstack.services.storage import cinder_v2 from tests.unit import fakes from tests.unit import test diff --git a/tests/unit/plugins/openstack/test_osclients.py b/tests/unit/plugins/openstack/test_osclients.py index 27b717496e..1c0ad545e8 100644 --- a/tests/unit/plugins/openstack/test_osclients.py +++ b/tests/unit/plugins/openstack/test_osclients.py @@ -15,8 +15,8 @@ import ddt import mock -from oslo_config import cfg +from rally.common import cfg from rally import consts from rally import exceptions from rally import osclients as deprecated_osclients # noqa diff --git a/tests/unit/plugins/openstack/verification/tempest/test_config.py b/tests/unit/plugins/openstack/verification/tempest/test_config.py index a59dce3ffd..f08ed441fe 100644 --- a/tests/unit/plugins/openstack/verification/tempest/test_config.py +++ b/tests/unit/plugins/openstack/verification/tempest/test_config.py @@ -15,8 +15,8 @@ import ddt import mock -from oslo_config import cfg +from rally.common import cfg from rally.plugins.openstack import osclients from rally.plugins.openstack.verification.tempest import config from tests.unit import fakes diff --git a/tests/unit/plugins/openstack/verification/tempest/test_context.py b/tests/unit/plugins/openstack/verification/tempest/test_context.py index 50f262d351..cc76790173 100644 --- a/tests/unit/plugins/openstack/verification/tempest/test_context.py +++ b/tests/unit/plugins/openstack/verification/tempest/test_context.py @@ -17,9 +17,9 @@ import os import ddt import mock -from oslo_config import cfg import requests +from rally.common import cfg from rally import exceptions from rally.plugins.openstack.verification.tempest import config from rally.plugins.openstack.verification.tempest import context diff --git a/tests/unit/plugins/openstack/wrappers/test_glance.py b/tests/unit/plugins/openstack/wrappers/test_glance.py index 98fa5e17fa..02f926f410 100644 --- a/tests/unit/plugins/openstack/wrappers/test_glance.py +++ b/tests/unit/plugins/openstack/wrappers/test_glance.py @@ -18,8 +18,8 @@ import tempfile import ddt from glanceclient import exc as glance_exc import mock -from oslo_config import cfg +from rally.common import cfg from rally import exceptions from rally.plugins.openstack.wrappers import glance as glance_wrapper from tests.unit import test diff --git a/tests/unit/test.py b/tests/unit/test.py index 6933b43676..f1aa20ed80 100644 --- a/tests/unit/test.py +++ b/tests/unit/test.py @@ -18,15 +18,15 @@ import os import uuid import mock -from oslo_config import fixture from oslotest import base +from rally.common import cfg from rally.common import db from rally import plugins from tests.unit import fakes -class DatabaseFixture(fixture.Config): +class DatabaseFixture(cfg.fixture.Config): """Create clean DB before starting test.""" def setUp(self): super(DatabaseFixture, self).setUp() diff --git a/tests/unit/test_api.py b/tests/unit/test_api.py index ce0616ed5e..4da0baf23e 100644 --- a/tests/unit/test_api.py +++ b/tests/unit/test_api.py @@ -20,9 +20,9 @@ import os import ddt import mock -from oslo_config import cfg from rally import api +from rally.common import cfg from rally.common import objects from rally import consts from rally import exceptions