Move undercloud.conf to the undercloud config namespace

To match the generation for standalone.conf, this change moves the
config generation out to the undercloud config namespace instead of
including it in the undercloud_config namespace from the actions.
Eventually we'll want to handle the configuration parsing elsewhere so
we need to move this logic out so it can be shared and consumed via the
tripleo_deploy action.

Change-Id: I6d8bd04d2547a513dfe46d5144283e45366efeb3
Related-Blueprint: all-in-one
This commit is contained in:
Alex Schultz 2018-05-18 11:45:18 -06:00
parent c0f566cc2e
commit b22c218ace
3 changed files with 21 additions and 11 deletions

View File

@ -99,5 +99,5 @@ openstack.tripleoclient.v1 =
undercloud_upgrade = tripleoclient.v1.undercloud:UpgradeUndercloud undercloud_upgrade = tripleoclient.v1.undercloud:UpgradeUndercloud
undercloud_backup = tripleoclient.v1.undercloud_backup:BackupUndercloud undercloud_backup = tripleoclient.v1.undercloud_backup:BackupUndercloud
oslo.config.opts = oslo.config.opts =
undercloud_config = tripleoclient.v1.undercloud_config:list_opts undercloud_config = tripleoclient.config.undercloud:list_opts
standalone_config = tripleoclient.config.standalone:list_opts standalone_config = tripleoclient.config.standalone:list_opts

View File

@ -13,10 +13,14 @@
# under the License. # under the License.
# #
import copy
from osc_lib.i18n import _ from osc_lib.i18n import _
from oslo_config import cfg from oslo_config import cfg
from tripleoclient.config.standalone import StandaloneConfig from tripleoclient.config.standalone import StandaloneConfig
CONF = cfg.CONF
# Control plane network name # Control plane network name
SUBNETS_DEFAULT = ['ctlplane-subnet'] SUBNETS_DEFAULT = ['ctlplane-subnet']
@ -346,3 +350,17 @@ class UndercloudConfig(StandaloneConfig):
'access.')), 'access.')),
] ]
return self.sort_opts(_subnets_opts) return self.sort_opts(_subnets_opts)
def list_opts():
"""List config opts for oslo config generator"""
config = UndercloudConfig()
_opts = config.get_opts()
return [(None, copy.deepcopy(_opts)),
(SUBNETS_DEFAULT[0], copy.deepcopy(config.get_subnet_opts()))]
def load_global_config():
"""Register UndercloudConfig options into global config"""
_opts = UndercloudConfig().get_opts()
CONF.register_opts(_opts)

View File

@ -15,7 +15,6 @@
"""Plugin action implementation""" """Plugin action implementation"""
import copy
import jinja2 import jinja2
import json import json
import logging import logging
@ -32,7 +31,7 @@ from osc_lib.i18n import _
from oslo_config import cfg from oslo_config import cfg
from tripleo_common.image import kolla_builder from tripleo_common.image import kolla_builder
from tripleoclient.config.undercloud import SUBNETS_DEFAULT from tripleoclient.config.undercloud import load_global_config
from tripleoclient.config.undercloud import UndercloudConfig from tripleoclient.config.undercloud import UndercloudConfig
from tripleoclient import exceptions from tripleoclient import exceptions
from tripleoclient import utils from tripleoclient import utils
@ -104,7 +103,7 @@ config = UndercloudConfig()
# Routed subnets # Routed subnets
_opts = config.get_opts() _opts = config.get_opts()
CONF.register_opts(_opts) load_global_config()
def _load_subnets_config_groups(): def _load_subnets_config_groups():
@ -112,16 +111,9 @@ def _load_subnets_config_groups():
g = cfg.OptGroup(name=group, title=group) g = cfg.OptGroup(name=group, title=group)
CONF.register_opts(config.get_subnet_opts(), group=g) CONF.register_opts(config.get_subnet_opts(), group=g)
LOG = logging.getLogger(__name__ + ".undercloud_config") LOG = logging.getLogger(__name__ + ".undercloud_config")
# this is needed for the oslo config generator
def list_opts():
return [(None, copy.deepcopy(_opts)),
(SUBNETS_DEFAULT[0], copy.deepcopy(config.get_subnet_opts()))]
def _load_config(): def _load_config():
conf_params = [] conf_params = []
if os.path.isfile(PATHS.CONF_PATH): if os.path.isfile(PATHS.CONF_PATH):