Merge "Fix use of the oslo-config-generator"
This commit is contained in:
commit
e8cdd14bc8
|
@ -1,5 +0,0 @@
|
||||||
[DEFAULT]
|
|
||||||
output_file = etc/muranoagent/muranoagent.conf.sample
|
|
||||||
namespace = muranoagent.common.config
|
|
||||||
namespace = muranoagent.openstack.common.log
|
|
||||||
namespace = muranoagent.openstack.common.eventlet_backdoor
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
[DEFAULT]
|
||||||
|
output_file = etc/muranoagent/muranoagent.conf.sample
|
||||||
|
namespace = muranoagent
|
|
@ -17,7 +17,6 @@
|
||||||
Routines for configuring Murano-Agent
|
Routines for configuring Murano-Agent
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import copy
|
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
|
@ -29,9 +28,12 @@ from oslo.config import cfg
|
||||||
from muranoagent import version
|
from muranoagent import version
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
CONF.register_cli_opt(cfg.StrOpt('storage',
|
|
||||||
default='/var/murano/plans',
|
storage_opt = [
|
||||||
help='Directory to store execution plans'))
|
cfg.StrOpt('storage',
|
||||||
|
default='/var/murano/plans',
|
||||||
|
help='Directory to store execution plans')
|
||||||
|
]
|
||||||
|
|
||||||
rabbit_opts = [
|
rabbit_opts = [
|
||||||
cfg.StrOpt('host',
|
cfg.StrOpt('host',
|
||||||
|
@ -66,13 +68,10 @@ rabbit_opts = [
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
CONF.register_cli_opts(storage_opt)
|
||||||
CONF.register_opts(rabbit_opts, group='rabbitmq')
|
CONF.register_opts(rabbit_opts, group='rabbitmq')
|
||||||
|
|
||||||
|
|
||||||
def list_opts():
|
|
||||||
return [('rabbitmq', copy.deepcopy(rabbit_opts))]
|
|
||||||
|
|
||||||
|
|
||||||
def parse_args(args=None, usage=None, default_config_files=None):
|
def parse_args(args=None, usage=None, default_config_files=None):
|
||||||
version_string = version.version_info.version_string()
|
version_string = version.version_info.version_string()
|
||||||
CONF(args=args,
|
CONF(args=args,
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
import copy
|
|
||||||
import gc
|
import gc
|
||||||
import os
|
import os
|
||||||
import pprint
|
import pprint
|
||||||
|
@ -58,9 +57,6 @@ class EventletBackdoorConfigValueError(Exception):
|
||||||
super(EventletBackdoorConfigValueError, self).__init__(msg)
|
super(EventletBackdoorConfigValueError, self).__init__(msg)
|
||||||
self.port_range = port_range
|
self.port_range = port_range
|
||||||
|
|
||||||
def list_opts():
|
|
||||||
return [(None, copy.deepcopy(eventlet_backdoor_opts))]
|
|
||||||
|
|
||||||
|
|
||||||
def _dont_use_this():
|
def _dont_use_this():
|
||||||
print("Don't use this, just disconnect instead")
|
print("Don't use this, just disconnect instead")
|
||||||
|
|
|
@ -27,7 +27,6 @@ It also allows setting of formatting information through conf.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import copy
|
|
||||||
import inspect
|
import inspect
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
|
@ -184,14 +183,6 @@ CONF.register_opts(log_opts)
|
||||||
logging.AUDIT = logging.INFO + 1
|
logging.AUDIT = logging.INFO + 1
|
||||||
logging.addLevelName(logging.AUDIT, 'AUDIT')
|
logging.addLevelName(logging.AUDIT, 'AUDIT')
|
||||||
|
|
||||||
|
|
||||||
def list_opts():
|
|
||||||
yield None, copy.deepcopy(common_cli_opts)
|
|
||||||
yield None, copy.deepcopy(logging_cli_opts)
|
|
||||||
yield None, copy.deepcopy(generic_log_opts)
|
|
||||||
yield None, copy.deepcopy(log_opts)
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
NullHandler = logging.NullHandler
|
NullHandler = logging.NullHandler
|
||||||
except AttributeError: # NOTE(jkoelker) NullHandler added in Python 2.7
|
except AttributeError: # NOTE(jkoelker) NullHandler added in Python 2.7
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
# Copyright (c) 2014 Mirantis, Inc.
|
||||||
|
#
|
||||||
|
# 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 copy
|
||||||
|
import itertools
|
||||||
|
|
||||||
|
import muranoagent.common.config
|
||||||
|
import muranoagent.openstack.common.eventlet_backdoor
|
||||||
|
import muranoagent.openstack.common.log
|
||||||
|
|
||||||
|
|
||||||
|
def build_list(opt_list):
|
||||||
|
return list(itertools.chain(*opt_list))
|
||||||
|
|
||||||
|
|
||||||
|
# List of *all* options in [DEFAULT] namespace of murano.
|
||||||
|
# Any new option list or option needs to be registered here.
|
||||||
|
_opt_lists = [
|
||||||
|
('rabbitmq', muranoagent.common.config.rabbit_opts),
|
||||||
|
(None, build_list([
|
||||||
|
muranoagent.common.config.storage_opt,
|
||||||
|
muranoagent.openstack.common.eventlet_backdoor.eventlet_backdoor_opts,
|
||||||
|
muranoagent.openstack.common.log.common_cli_opts,
|
||||||
|
muranoagent.openstack.common.log.generic_log_opts,
|
||||||
|
muranoagent.openstack.common.log.log_opts,
|
||||||
|
muranoagent.openstack.common.log.logging_cli_opts
|
||||||
|
]))
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def list_opts():
|
||||||
|
"""Return a list of oslo.config options available in Murano-Agent.
|
||||||
|
|
||||||
|
Each element of the list is a tuple. The first element is the name of the
|
||||||
|
group under which the list of elements in the second element will be
|
||||||
|
registered. A group name of None corresponds to the [DEFAULT] group in
|
||||||
|
config files.
|
||||||
|
|
||||||
|
This function is also discoverable via the 'muranoagent' entry point
|
||||||
|
under the 'oslo.config.opts' namespace.
|
||||||
|
|
||||||
|
The purpose of this is to allow tools like the Oslo sample config file
|
||||||
|
generator to discover the options exposed to users by Murano.
|
||||||
|
|
||||||
|
:returns: a list of (group_name, opts) tuples
|
||||||
|
"""
|
||||||
|
return [(g, copy.deepcopy(o)) for g, o in _opt_lists]
|
|
@ -7,7 +7,6 @@ module=importutils
|
||||||
module=jsonutils
|
module=jsonutils
|
||||||
module=log
|
module=log
|
||||||
module=install_venv_common
|
module=install_venv_common
|
||||||
module=config
|
|
||||||
module=service
|
module=service
|
||||||
module=strutils
|
module=strutils
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,7 @@ setup-hooks =
|
||||||
|
|
||||||
[entry_points]
|
[entry_points]
|
||||||
oslo.config.opts =
|
oslo.config.opts =
|
||||||
muranoagent.common.config = muranoagent.common.config:list_opts
|
muranoagent = muranoagent.opts:list_opts
|
||||||
muranoagent.openstack.common.eventlet_backdoor = muranoagent.openstack.common.eventlet_backdoor:list_opts
|
|
||||||
muranoagent.openstack.common.log = muranoagent.openstack.common.log:list_opts
|
|
||||||
|
|
||||||
console_scripts =
|
console_scripts =
|
||||||
muranoagent = muranoagent.cmd.run:main
|
muranoagent = muranoagent.cmd.run:main
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -32,7 +32,7 @@ deps = flake8
|
||||||
commands = flake8
|
commands = flake8
|
||||||
|
|
||||||
[testenv:genconfig]
|
[testenv:genconfig]
|
||||||
commands = oslo-config-generator --config-file config-generator.conf
|
commands = oslo-config-generator --config-file etc/oslo-config-generator/muranoagent.conf
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# H301 one import per line
|
# H301 one import per line
|
||||||
|
|
Loading…
Reference in New Issue