nova/nova/conf/base.py
Jim Rollenhagen 9cb825b014 Ensure config regexes match the entire string
Oslo.config uses re.search() to check config values against the allowed
regex. This checks if the regex matches anywhere in the string, rather
than checking if the entire string matches the regex.

Make sure config options where the entire string should match the given
regex actually do so.

Change-Id: I9e30a24a4c0640f282f507d0a96640d3cdefe43c
Closes-Bug: #1815763
2019-02-13 08:16:45 -05:00

72 lines
2.3 KiB
Python

# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# 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
base_options = [
cfg.IntOpt(
'password_length',
default=12,
min=0,
help='Length of generated instance admin passwords.'),
cfg.StrOpt(
'instance_usage_audit_period',
default='month',
regex='^(hour|month|day|year)(@([0-9]+))?$',
help='''
Time period to generate instance usages for. It is possible to define optional
offset to given period by appending @ character followed by a number defining
offset.
Possible values:
* period, example: ``hour``, ``day``, ``month` or ``year``
* period with offset, example: ``month@15`` will result in monthly audits
starting on 15th day of month.
'''),
cfg.BoolOpt(
'use_rootwrap_daemon',
default=False,
help='''
Start and use a daemon that can run the commands that need to be run with
root privileges. This option is usually enabled on nodes that run nova compute
processes.
'''),
cfg.StrOpt(
'rootwrap_config',
default="/etc/nova/rootwrap.conf",
help='''
Path to the rootwrap configuration file.
Goal of the root wrapper is to allow a service-specific unprivileged user to
run a number of actions as the root user in the safest manner possible.
The configuration file used here must match the one defined in the sudoers
entry.
'''),
cfg.StrOpt(
'tempdir',
help='Explicitly specify the temporary working directory.'),
]
def register_opts(conf):
conf.register_opts(base_options)
def list_opts():
return {'DEFAULT': base_options}