Centralize config option: certificates section
Centralize config option of certificates section. Replace oslo_conf cfg to magnum.conf. Change-Id: I3433b1a6d5c07c10b28b657dda186a658df5c5c4 Implements: blueprint centralize-config-magnum
This commit is contained in:
parent
6d6cfb87b6
commit
19d80981a7
@ -12,21 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from stevedore import driver
|
||||
|
||||
CONF = cfg.CONF
|
||||
import magnum.conf
|
||||
|
||||
DEFAULT_CERT_MANAGER = 'barbican'
|
||||
|
||||
cert_manager_opts = [
|
||||
cfg.StrOpt('cert_manager_type',
|
||||
default=DEFAULT_CERT_MANAGER,
|
||||
help='Certificate Manager plugin. '
|
||||
'Defaults to {0}.'.format(DEFAULT_CERT_MANAGER))
|
||||
]
|
||||
|
||||
CONF.register_opts(cert_manager_opts, group='certificates')
|
||||
CONF = magnum.conf.CONF
|
||||
|
||||
_CERT_MANAGER_PLUGIN = None
|
||||
|
||||
@ -36,5 +26,5 @@ def get_backend():
|
||||
if not _CERT_MANAGER_PLUGIN:
|
||||
_CERT_MANAGER_PLUGIN = driver.DriverManager(
|
||||
"magnum.cert_manager.backend",
|
||||
cfg.CONF.certificates.cert_manager_type).driver
|
||||
CONF.certificates.cert_manager_type).driver
|
||||
return _CERT_MANAGER_PLUGIN
|
||||
|
@ -16,30 +16,18 @@ import os
|
||||
from os import path
|
||||
import uuid
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from magnum.common.cert_manager import cert_manager
|
||||
from magnum.common import exception
|
||||
import magnum.conf
|
||||
from magnum.i18n import _
|
||||
from magnum.i18n import _LE
|
||||
from magnum.i18n import _LW
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
TLS_STORAGE_DEFAULT = '/var/lib/magnum/certificates/'
|
||||
|
||||
local_cert_manager_opts = [
|
||||
cfg.StrOpt('storage_path',
|
||||
default=TLS_STORAGE_DEFAULT,
|
||||
help='Absolute path of the certificate storage directory. '
|
||||
'Defaults to /var/lib/magnum/certificates/.')
|
||||
]
|
||||
|
||||
CONF.register_opts(local_cert_manager_opts, group='certificates')
|
||||
CONF = magnum.conf.CONF
|
||||
|
||||
|
||||
class Cert(cert_manager.Cert):
|
||||
|
@ -17,7 +17,7 @@ from oslo_config import cfg
|
||||
|
||||
from magnum.conf import api
|
||||
from magnum.conf import barbican
|
||||
# from magnum.conf import certificates
|
||||
from magnum.conf import certificates
|
||||
from magnum.conf import cinder
|
||||
from magnum.conf import cluster
|
||||
from magnum.conf import cluster_heat
|
||||
@ -44,7 +44,7 @@ barbican.register_opts(CONF)
|
||||
cluster.register_opts(CONF)
|
||||
cluster_templates.register_opts(CONF)
|
||||
cluster_heat.register_opts(CONF)
|
||||
# certificates.register_opts(CONF)
|
||||
certificates.register_opts(CONF)
|
||||
cinder.register_opts(CONF)
|
||||
conductor.register_opts(CONF)
|
||||
database.register_opts(CONF)
|
||||
|
51
magnum/conf/certificates.py
Normal file
51
magnum/conf/certificates.py
Normal file
@ -0,0 +1,51 @@
|
||||
# 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.
|
||||
|
||||
import itertools
|
||||
from oslo_config import cfg
|
||||
|
||||
DEFAULT_CERT_MANAGER = 'barbican'
|
||||
TLS_STORAGE_DEFAULT = '/var/lib/magnum/certificates/'
|
||||
|
||||
certificates_group = cfg.OptGroup(name='certificates',
|
||||
title='Certificate options for the '
|
||||
'cert manager.')
|
||||
|
||||
cert_manager_opts = [
|
||||
cfg.StrOpt('cert_manager_type',
|
||||
default=DEFAULT_CERT_MANAGER,
|
||||
help='Certificate Manager plugin. '
|
||||
'Defaults to {0}.'.format(DEFAULT_CERT_MANAGER))
|
||||
]
|
||||
|
||||
local_cert_manager_opts = [
|
||||
cfg.StrOpt('storage_path',
|
||||
default=TLS_STORAGE_DEFAULT,
|
||||
help='Absolute path of the certificate storage directory. '
|
||||
'Defaults to /var/lib/magnum/certificates/.')
|
||||
]
|
||||
|
||||
ALL_OPTS = list(itertools.chain(
|
||||
cert_manager_opts,
|
||||
local_cert_manager_opts
|
||||
))
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_group(certificates_group)
|
||||
conf.register_opts(ALL_OPTS, group=certificates_group)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {
|
||||
certificates_group: ALL_OPTS
|
||||
}
|
@ -13,10 +13,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import itertools
|
||||
|
||||
import magnum.common.cert_manager
|
||||
from magnum.common.cert_manager import local_cert_manager
|
||||
import magnum.common.exception
|
||||
import magnum.common.x509.config
|
||||
import magnum.db
|
||||
@ -27,10 +23,6 @@ def list_opts():
|
||||
return [
|
||||
('trust', magnum.common.keystone.trust_opts),
|
||||
('x509', magnum.common.x509.config.x509_opts),
|
||||
('certificates',
|
||||
itertools.chain(magnum.common.cert_manager.cert_manager_opts,
|
||||
local_cert_manager.local_cert_manager_opts,
|
||||
)),
|
||||
('keystone_auth', magnum.common.keystone.keystone_auth_opts),
|
||||
('docker_registry',
|
||||
magnum.drivers.common.template_def.docker_registry_opts)
|
||||
|
Loading…
Reference in New Issue
Block a user