Merge "Centralize config option: docker section"

This commit is contained in:
Jenkins 2016-09-24 12:35:05 +00:00 committed by Gerrit Code Review
commit 4bc224b268
7 changed files with 60 additions and 51 deletions

View File

@ -17,37 +17,13 @@ import docker
from docker import client
from docker import tls
from docker.utils import utils
from oslo_config import cfg
from magnum.conductor.handlers.common import cert_manager
from magnum.conductor import utils as conductor_utils
import magnum.conf
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).'),
]
CONF = cfg.CONF
CONF.register_opts(docker_opts, 'docker')
CONF = magnum.conf.CONF
def parse_docker_image(image):

View File

@ -15,23 +15,17 @@
import abc
from oslo_config import cfg
from oslo_log import log
from oslo_utils import importutils
import six
import magnum.conf
from magnum.objects import fields
LOG = log.getLogger(__name__)
CONF = cfg.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')
CONF = magnum.conf.CONF
COE_CLASS_PATH = {
fields.ClusterType.SWARM: 'magnum.conductor.swarm_monitor.SwarmMonitor',

View File

@ -24,7 +24,7 @@ from magnum.conf import cluster_heat
from magnum.conf import cluster_templates
from magnum.conf import conductor
from magnum.conf import database
# from magnum.conf import docker
from magnum.conf import docker
from magnum.conf import glance
from magnum.conf import heat
# from magnum.conf import keystone
@ -48,7 +48,7 @@ cluster_heat.register_opts(CONF)
cinder.register_opts(CONF)
conductor.register_opts(CONF)
database.register_opts(CONF)
# docker.register_opts(CONF)
docker.register_opts(CONF)
glance.register_opts(CONF)
heat.register_opts(CONF)
# keystone.register_opts(CONF)

50
magnum/conf/docker.py Normal file
View 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
}

View File

@ -17,7 +17,6 @@ import itertools
import magnum.common.cert_manager
from magnum.common.cert_manager import local_cert_manager
import magnum.common.docker_utils
import magnum.common.exception
import magnum.common.x509.config
import magnum.db
@ -26,7 +25,6 @@ import magnum.drivers.common.template_def
def list_opts():
return [
('docker', magnum.common.docker_utils.docker_opts),
('trust', magnum.common.keystone.trust_opts),
('x509', magnum.common.x509.config.x509_opts),
('certificates',

View File

@ -13,19 +13,15 @@
import time
from docker import errors
from oslo_config import cfg
from requests import exceptions as req_exceptions
from magnum.common import docker_utils
import magnum.conf
from magnum.i18n import _LI
from magnum.tests.functional.python_client_base import ClusterTest
CONF = cfg.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')
CONF = magnum.conf.CONF
class TestSwarmAPIs(ClusterTest):

View File

@ -14,18 +14,13 @@
from docker import client as docker_py_client
import mock
from oslo_config import cfg
from magnum.common import docker_utils
import magnum.conf
from magnum.tests import base
CONF = cfg.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')
CONF = magnum.conf.CONF
class TestDockerUtils(base.BaseTestCase):