From b22c218ace3256183a8b77b2a7466ac2dec8d254 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Fri, 18 May 2018 11:45:18 -0600 Subject: [PATCH] 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 --- setup.cfg | 2 +- tripleoclient/config/undercloud.py | 18 ++++++++++++++++++ tripleoclient/v1/undercloud_config.py | 12 ++---------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/setup.cfg b/setup.cfg index c6ccc9971..c626f6fc2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -99,5 +99,5 @@ openstack.tripleoclient.v1 = undercloud_upgrade = tripleoclient.v1.undercloud:UpgradeUndercloud undercloud_backup = tripleoclient.v1.undercloud_backup:BackupUndercloud 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 diff --git a/tripleoclient/config/undercloud.py b/tripleoclient/config/undercloud.py index af908bb1b..3601aefe8 100644 --- a/tripleoclient/config/undercloud.py +++ b/tripleoclient/config/undercloud.py @@ -13,10 +13,14 @@ # under the License. # +import copy + from osc_lib.i18n import _ from oslo_config import cfg from tripleoclient.config.standalone import StandaloneConfig +CONF = cfg.CONF + # Control plane network name SUBNETS_DEFAULT = ['ctlplane-subnet'] @@ -346,3 +350,17 @@ class UndercloudConfig(StandaloneConfig): 'access.')), ] 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) diff --git a/tripleoclient/v1/undercloud_config.py b/tripleoclient/v1/undercloud_config.py index 1b70d4a1e..8fcb9b41a 100644 --- a/tripleoclient/v1/undercloud_config.py +++ b/tripleoclient/v1/undercloud_config.py @@ -15,7 +15,6 @@ """Plugin action implementation""" -import copy import jinja2 import json import logging @@ -32,7 +31,7 @@ from osc_lib.i18n import _ from oslo_config import cfg 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 import exceptions from tripleoclient import utils @@ -104,7 +103,7 @@ config = UndercloudConfig() # Routed subnets _opts = config.get_opts() -CONF.register_opts(_opts) +load_global_config() def _load_subnets_config_groups(): @@ -112,16 +111,9 @@ def _load_subnets_config_groups(): g = cfg.OptGroup(name=group, title=group) CONF.register_opts(config.get_subnet_opts(), group=g) - 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(): conf_params = [] if os.path.isfile(PATHS.CONF_PATH):