From cf5371ede76084593a4d3961a111ca37df7b544c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Mon, 24 Sep 2018 23:37:53 +0200 Subject: [PATCH] Undercloud Validations - Deprecated (replaced/removed) opts Add a validation method to check for invalid (replaced/removed) configuration options. Fail the validations if any such options are detected in the configuration. After the deprecation period is over and options are removed we can add options to 'invalid_opts' to make sure users update their configuration. Closes-Bug: #1794038 Depends-On: Ia29a3aaeb23e63d68cfe4891436446093016ea3c Change-Id: I26a1626aac9178ed87176b6577fcca970dfc182b --- tripleoclient/v1/undercloud_preflight.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tripleoclient/v1/undercloud_preflight.py b/tripleoclient/v1/undercloud_preflight.py index 8905ef155..5892f5169 100644 --- a/tripleoclient/v1/undercloud_preflight.py +++ b/tripleoclient/v1/undercloud_preflight.py @@ -497,6 +497,25 @@ def _check_routed_networks_enabled_if_multiple_subnets_defined(): raise FailedValidation(msg) +def _validate_deprecetad_now_invalid_parameters(): + invalid_opts = [ + 'masquerade_network', + ] + deprecate_conf = cfg.CONF + invalid_opts_used = [] + + for invalid_opt in invalid_opts: + deprecate_conf.register_opts([cfg.StrOpt(invalid_opt)]) + if deprecate_conf.get(invalid_opt): + invalid_opts_used.append(invalid_opt) + if invalid_opts_used: + msg = _('Options that has been deprecated and removed/replaced ' + 'detected. Invalid options: %s') % invalid_opts_used + LOG.error(msg) + raise FailedValidation(msg) + del deprecate_conf + + def check(verbose_level, upgrade=False): # Fetch configuration and use its log file param to add logging to a file utils.load_config(CONF, constants.UNDERCLOUD_CONF_PATH) @@ -515,6 +534,8 @@ def check(verbose_level, upgrade=False): _check_sysctl() _checking_status('Password file') _validate_passwords_file() + _checking_status('Deprecated now invalid options') + _validate_deprecetad_now_invalid_parameters() # Heat templates validations if CONF.get('custom_env_files'): _checking_status('Custom env file')