Centralize config option: utils section
Centralize config option of utils section. Replace oslo_conf cfg to magnum.conf. Change-Id: I0014d8dfaf81d845bc92e145ffff9fecaed7240d Implements: blueprint centralize-config-magnum
This commit is contained in:
parent
d86b5735cd
commit
cc839e86af
@ -26,36 +26,15 @@ import shutil
|
||||
import tempfile
|
||||
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from magnum.common import exception
|
||||
import magnum.conf
|
||||
from magnum.i18n import _LE
|
||||
from magnum.i18n import _LW
|
||||
|
||||
|
||||
# Default symbols to use for passwords. Avoids visually confusing characters.
|
||||
# ~6 bits per symbol
|
||||
DEFAULT_PASSWORD_SYMBOLS = ['23456789', # Removed: 0,1
|
||||
'ABCDEFGHJKLMNPQRSTUVWXYZ', # Removed: I, O
|
||||
'abcdefghijkmnopqrstuvwxyz'] # Removed: l
|
||||
|
||||
UTILS_OPTS = [
|
||||
cfg.StrOpt('rootwrap_config',
|
||||
default="/etc/magnum/rootwrap.conf",
|
||||
help='Path to the rootwrap configuration file to use for '
|
||||
'running commands as root.'),
|
||||
cfg.StrOpt('tempdir',
|
||||
help='Explicitly specify the temporary working directory.'),
|
||||
cfg.ListOpt('password_symbols',
|
||||
default=DEFAULT_PASSWORD_SYMBOLS,
|
||||
help='Symbols to use for passwords')
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(UTILS_OPTS)
|
||||
|
||||
CONF = magnum.conf.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
MEMORY_UNITS = {
|
||||
|
@ -32,6 +32,7 @@ from magnum.conf import magnum_client
|
||||
from magnum.conf import neutron
|
||||
from magnum.conf import nova
|
||||
from magnum.conf import paths
|
||||
from magnum.conf import utils
|
||||
# from magnum.conf import x509
|
||||
|
||||
CONF = cfg.CONF
|
||||
@ -53,4 +54,5 @@ magnum_client.register_opts(CONF)
|
||||
neutron.register_opts(CONF)
|
||||
nova.register_opts(CONF)
|
||||
paths.register_opts(CONF)
|
||||
utils.register_opts(CONF)
|
||||
# x509.register_opts(CONF)
|
||||
|
42
magnum/conf/utils.py
Normal file
42
magnum/conf/utils.py
Normal file
@ -0,0 +1,42 @@
|
||||
# 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
|
||||
|
||||
|
||||
# Default symbols to use for passwords. Avoids visually confusing characters.
|
||||
# ~6 bits per symbol
|
||||
DEFAULT_PASSWORD_SYMBOLS = ['23456789', # Removed: 0,1
|
||||
'ABCDEFGHJKLMNPQRSTUVWXYZ', # Removed: I, O
|
||||
'abcdefghijkmnopqrstuvwxyz'] # Removed: l
|
||||
|
||||
utils_opts = [
|
||||
cfg.StrOpt('rootwrap_config',
|
||||
default="/etc/magnum/rootwrap.conf",
|
||||
help='Path to the rootwrap configuration file to use for '
|
||||
'running commands as root.'),
|
||||
cfg.StrOpt('tempdir',
|
||||
help='Explicitly specify the temporary working directory.'),
|
||||
cfg.ListOpt('password_symbols',
|
||||
default=DEFAULT_PASSWORD_SYMBOLS,
|
||||
help='Symbols to use for passwords')
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(utils_opts)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {
|
||||
"DEFAULT": utils_opts
|
||||
}
|
@ -20,7 +20,6 @@ from magnum.common.cert_manager import local_cert_manager
|
||||
import magnum.common.exception
|
||||
import magnum.common.rpc_service
|
||||
import magnum.common.service
|
||||
import magnum.common.utils
|
||||
import magnum.common.x509.config
|
||||
import magnum.db
|
||||
import magnum.drivers.common.template_def
|
||||
@ -29,8 +28,7 @@ import magnum.drivers.common.template_def
|
||||
def list_opts():
|
||||
return [
|
||||
('DEFAULT',
|
||||
itertools.chain(magnum.common.utils.UTILS_OPTS,
|
||||
magnum.common.rpc_service.periodic_opts,
|
||||
itertools.chain(magnum.common.rpc_service.periodic_opts,
|
||||
magnum.common.service.service_opts,
|
||||
)),
|
||||
('docker', magnum.common.docker_utils.docker_opts),
|
||||
|
Loading…
x
Reference in New Issue
Block a user