Remove unnecessary import_opt|group
Usually, we should import an option before we use it, otherwise, NoSuchOpt exception will be raised. When we import a module, the options in that module are registered, (or imported), so we don't need to explicitly import them again. However, it is a bit hard for developers, reviewers and maintainers to track between files just to check if a specific option is imported or not. So it is good (not required) whenever we use an option, we import it explicitly, such kind of redundant is acceptable. But not the case that we already import a module A, then import_opt|group registered or imported in that module again, this is obviously unnecessary and should be avoid. Change-Id: I8672d9f12d862f9a622e5557d9c8dc2fe6717f5e Closes-Bug: #1389229
This commit is contained in:
parent
86d84a6dbd
commit
d288a28589
@ -37,9 +37,6 @@ from ceilometer import utils
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
cfg.CONF.import_opt('heartbeat', 'ceilometer.coordination',
|
||||
group='coordination')
|
||||
|
||||
|
||||
class PollsterListForbidden(Exception):
|
||||
def __init__(self):
|
||||
|
@ -45,12 +45,6 @@ OPTS = [
|
||||
]
|
||||
|
||||
cfg.CONF.register_opts(OPTS, group='alarm')
|
||||
cfg.CONF.import_opt('notifier_rpc_topic', 'ceilometer.alarm.rpc',
|
||||
group='alarm')
|
||||
cfg.CONF.import_opt('partition_rpc_topic', 'ceilometer.alarm.rpc',
|
||||
group='alarm')
|
||||
cfg.CONF.import_opt('heartbeat', 'ceilometer.coordination',
|
||||
group='coordination')
|
||||
cfg.CONF.import_opt('http_timeout', 'ceilometer.service')
|
||||
cfg.CONF.import_group('service_credentials', 'ceilometer.service')
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
# under the License.
|
||||
"""MongoDB storage backend"""
|
||||
|
||||
from oslo.config import cfg
|
||||
import pymongo
|
||||
|
||||
from ceilometer.alarm.storage import pymongo_base
|
||||
@ -28,9 +27,6 @@ from ceilometer.openstack.common import log
|
||||
from ceilometer import storage
|
||||
from ceilometer.storage.mongo import utils as pymongo_utils
|
||||
|
||||
cfg.CONF.import_opt('time_to_live', 'ceilometer.storage',
|
||||
group="database")
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -35,7 +35,6 @@ from ceilometer import storage
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('debug', 'ceilometer.openstack.common.log')
|
||||
|
||||
OPTS = [
|
||||
cfg.StrOpt('api_paste_config',
|
||||
|
@ -22,9 +22,6 @@ from ceilometer.i18n import _
|
||||
from ceilometer import service
|
||||
from ceilometer import storage
|
||||
|
||||
cfg.CONF.import_opt('time_to_live', 'ceilometer.storage',
|
||||
group='database')
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -30,8 +30,6 @@ from ceilometer import sample
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
cfg.CONF.import_group('service_types', 'ceilometer.nova_client')
|
||||
|
||||
|
||||
class FloatingIPPollster(plugin_base.PollsterBase):
|
||||
|
||||
|
@ -21,9 +21,6 @@ from ceilometer.agent import plugin_base
|
||||
from ceilometer import neutron_client
|
||||
|
||||
|
||||
cfg.CONF.import_group('service_types', 'ceilometer.neutron_client')
|
||||
|
||||
|
||||
class _BaseServicesDiscovery(plugin_base.DiscoveryBase):
|
||||
|
||||
def __init__(self):
|
||||
|
@ -91,9 +91,6 @@ CLI_OPTS = [
|
||||
]
|
||||
cfg.CONF.register_cli_opts(CLI_OPTS, group="service_credentials")
|
||||
|
||||
cfg.CONF.import_opt('default_log_levels',
|
||||
'ceilometer.openstack.common.log')
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -73,7 +73,6 @@ OPTS = [
|
||||
cfg.CONF.register_opts(OPTS, group='database')
|
||||
|
||||
db_options.set_defaults(cfg.CONF)
|
||||
cfg.CONF.import_opt('connection', 'oslo.db.options', group='database')
|
||||
|
||||
|
||||
class StorageBadVersion(Exception):
|
||||
|
@ -44,9 +44,6 @@ from ceilometer.storage.mongo import utils as pymongo_utils
|
||||
from ceilometer.storage import pymongo_base
|
||||
from ceilometer import utils
|
||||
|
||||
cfg.CONF.import_opt('time_to_live', 'ceilometer.storage',
|
||||
group="database")
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user