Centralize config option: docker section
Centralize config option of docker section. Replace oslo_conf cfg to magnum.conf. Change-Id: Ic8b2b2f0f9bfc6b02d75f57fab00c548b9d8f482 Implements: blueprint centralize-config-magnum
This commit is contained in:
parent
df6b42b168
commit
6d6cfb87b6
@ -17,37 +17,13 @@ import docker
|
|||||||
from docker import client
|
from docker import client
|
||||||
from docker import tls
|
from docker import tls
|
||||||
from docker.utils import utils
|
from docker.utils import utils
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
from magnum.conductor.handlers.common import cert_manager
|
from magnum.conductor.handlers.common import cert_manager
|
||||||
from magnum.conductor import utils as conductor_utils
|
from magnum.conductor import utils as conductor_utils
|
||||||
|
import magnum.conf
|
||||||
|
|
||||||
|
|
||||||
docker_opts = [
|
CONF = magnum.conf.CONF
|
||||||
cfg.StrOpt('docker_remote_api_version',
|
|
||||||
default='1.20',
|
|
||||||
help='Docker remote api version. Override it according to '
|
|
||||||
'specific docker api version in your environment.'),
|
|
||||||
cfg.IntOpt('default_timeout',
|
|
||||||
default=60,
|
|
||||||
help='Default timeout in seconds for docker client '
|
|
||||||
'operations.'),
|
|
||||||
cfg.BoolOpt('api_insecure',
|
|
||||||
default=False,
|
|
||||||
help='If set, ignore any SSL validation issues'),
|
|
||||||
cfg.StrOpt('ca_file',
|
|
||||||
help='Location of CA certificates file for '
|
|
||||||
'securing docker api requests (tlscacert).'),
|
|
||||||
cfg.StrOpt('cert_file',
|
|
||||||
help='Location of TLS certificate file for '
|
|
||||||
'securing docker api requests (tlscert).'),
|
|
||||||
cfg.StrOpt('key_file',
|
|
||||||
help='Location of TLS private key file for '
|
|
||||||
'securing docker api requests (tlskey).'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(docker_opts, 'docker')
|
|
||||||
|
|
||||||
|
|
||||||
def parse_docker_image(image):
|
def parse_docker_image(image):
|
||||||
|
@ -15,23 +15,17 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
import magnum.conf
|
||||||
from magnum.objects import fields
|
from magnum.objects import fields
|
||||||
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = magnum.conf.CONF
|
||||||
CONF.import_opt('docker_remote_api_version',
|
|
||||||
'magnum.common.docker_utils',
|
|
||||||
group='docker')
|
|
||||||
CONF.import_opt('default_timeout',
|
|
||||||
'magnum.common.docker_utils',
|
|
||||||
group='docker')
|
|
||||||
|
|
||||||
COE_CLASS_PATH = {
|
COE_CLASS_PATH = {
|
||||||
fields.ClusterType.SWARM: 'magnum.conductor.swarm_monitor.SwarmMonitor',
|
fields.ClusterType.SWARM: 'magnum.conductor.swarm_monitor.SwarmMonitor',
|
||||||
|
@ -24,7 +24,7 @@ from magnum.conf import cluster_heat
|
|||||||
from magnum.conf import cluster_templates
|
from magnum.conf import cluster_templates
|
||||||
from magnum.conf import conductor
|
from magnum.conf import conductor
|
||||||
from magnum.conf import database
|
from magnum.conf import database
|
||||||
# from magnum.conf import docker
|
from magnum.conf import docker
|
||||||
from magnum.conf import glance
|
from magnum.conf import glance
|
||||||
from magnum.conf import heat
|
from magnum.conf import heat
|
||||||
# from magnum.conf import keystone
|
# from magnum.conf import keystone
|
||||||
@ -48,7 +48,7 @@ cluster_heat.register_opts(CONF)
|
|||||||
cinder.register_opts(CONF)
|
cinder.register_opts(CONF)
|
||||||
conductor.register_opts(CONF)
|
conductor.register_opts(CONF)
|
||||||
database.register_opts(CONF)
|
database.register_opts(CONF)
|
||||||
# docker.register_opts(CONF)
|
docker.register_opts(CONF)
|
||||||
glance.register_opts(CONF)
|
glance.register_opts(CONF)
|
||||||
heat.register_opts(CONF)
|
heat.register_opts(CONF)
|
||||||
# keystone.register_opts(CONF)
|
# keystone.register_opts(CONF)
|
||||||
|
50
magnum/conf/docker.py
Normal file
50
magnum/conf/docker.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# 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 oslo_config import cfg
|
||||||
|
|
||||||
|
docker_group = cfg.OptGroup(name='docker',
|
||||||
|
title='Options for Docker engine')
|
||||||
|
|
||||||
|
docker_opts = [
|
||||||
|
cfg.StrOpt('docker_remote_api_version',
|
||||||
|
default='1.20',
|
||||||
|
help='Docker remote api version. Override it according to '
|
||||||
|
'specific docker api version in your environment.'),
|
||||||
|
cfg.IntOpt('default_timeout',
|
||||||
|
default=60,
|
||||||
|
help='Default timeout in seconds for docker client '
|
||||||
|
'operations.'),
|
||||||
|
cfg.BoolOpt('api_insecure',
|
||||||
|
default=False,
|
||||||
|
help='If set, ignore any SSL validation issues'),
|
||||||
|
cfg.StrOpt('ca_file',
|
||||||
|
help='Location of CA certificates file for '
|
||||||
|
'securing docker api requests (tlscacert).'),
|
||||||
|
cfg.StrOpt('cert_file',
|
||||||
|
help='Location of TLS certificate file for '
|
||||||
|
'securing docker api requests (tlscert).'),
|
||||||
|
cfg.StrOpt('key_file',
|
||||||
|
help='Location of TLS private key file for '
|
||||||
|
'securing docker api requests (tlskey).'),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def register_opts(conf):
|
||||||
|
conf.register_group(docker_group)
|
||||||
|
conf.register_opts(docker_opts, group=docker_group)
|
||||||
|
|
||||||
|
|
||||||
|
def list_opts():
|
||||||
|
return {
|
||||||
|
docker_group: docker_opts
|
||||||
|
}
|
@ -17,7 +17,6 @@ import itertools
|
|||||||
|
|
||||||
import magnum.common.cert_manager
|
import magnum.common.cert_manager
|
||||||
from magnum.common.cert_manager import local_cert_manager
|
from magnum.common.cert_manager import local_cert_manager
|
||||||
import magnum.common.docker_utils
|
|
||||||
import magnum.common.exception
|
import magnum.common.exception
|
||||||
import magnum.common.x509.config
|
import magnum.common.x509.config
|
||||||
import magnum.db
|
import magnum.db
|
||||||
@ -26,7 +25,6 @@ import magnum.drivers.common.template_def
|
|||||||
|
|
||||||
def list_opts():
|
def list_opts():
|
||||||
return [
|
return [
|
||||||
('docker', magnum.common.docker_utils.docker_opts),
|
|
||||||
('trust', magnum.common.keystone.trust_opts),
|
('trust', magnum.common.keystone.trust_opts),
|
||||||
('x509', magnum.common.x509.config.x509_opts),
|
('x509', magnum.common.x509.config.x509_opts),
|
||||||
('certificates',
|
('certificates',
|
||||||
|
@ -13,19 +13,15 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from docker import errors
|
from docker import errors
|
||||||
from oslo_config import cfg
|
|
||||||
from requests import exceptions as req_exceptions
|
from requests import exceptions as req_exceptions
|
||||||
|
|
||||||
from magnum.common import docker_utils
|
from magnum.common import docker_utils
|
||||||
|
import magnum.conf
|
||||||
from magnum.i18n import _LI
|
from magnum.i18n import _LI
|
||||||
from magnum.tests.functional.python_client_base import ClusterTest
|
from magnum.tests.functional.python_client_base import ClusterTest
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = magnum.conf.CONF
|
||||||
CONF.import_opt('docker_remote_api_version', 'magnum.common.docker_utils',
|
|
||||||
group='docker')
|
|
||||||
CONF.import_opt('default_timeout', 'magnum.common.docker_utils',
|
|
||||||
group='docker')
|
|
||||||
|
|
||||||
|
|
||||||
class TestSwarmAPIs(ClusterTest):
|
class TestSwarmAPIs(ClusterTest):
|
||||||
|
@ -14,18 +14,13 @@
|
|||||||
|
|
||||||
from docker import client as docker_py_client
|
from docker import client as docker_py_client
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
from magnum.common import docker_utils
|
from magnum.common import docker_utils
|
||||||
|
import magnum.conf
|
||||||
from magnum.tests import base
|
from magnum.tests import base
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = magnum.conf.CONF
|
||||||
|
|
||||||
CONF.import_opt('docker_remote_api_version', 'magnum.common.docker_utils',
|
|
||||||
group='docker')
|
|
||||||
CONF.import_opt('default_timeout', 'magnum.common.docker_utils',
|
|
||||||
group='docker')
|
|
||||||
|
|
||||||
|
|
||||||
class TestDockerUtils(base.BaseTestCase):
|
class TestDockerUtils(base.BaseTestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user