From 42f9f7a481709e4ed2a89b2c7b0a849ba9e00ff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Tue, 29 Jun 2021 10:30:21 +0200 Subject: [PATCH] Deprecate network data v1 definition Change the constant OVERCLOUD_NETWORKS_FILE to point to network_data_default.yaml in THT. (The new v2 default). Add check, and prompt the user for confirmation in case legacy networks definition is provided. The check and prompt can be disabled with the '--allow-deprecated-network-data' argument. Also add the '--yes' in 'OvercloudDeploy' and remove it in the Update nad Upgrade classes that will now inherit it. blueprint network-data-v2 Depends-On: I618c0a0d99c934fb65a6af30bc76096d52d4679d Depends-On: I759402fb22a9a3fd0fc06c8e107eee6eb5798c51 Change-Id: I2d14d9e587fce28ea0897bb235c9dedc8f68fa12 (cherry picked from commit 13a9ced063ded3da3ed5f10acd4ce4373f734601) --- tripleoclient/constants.py | 2 +- tripleoclient/v1/overcloud_deploy.py | 25 +++++++++++++++++++++++++ tripleoclient/v1/overcloud_update.py | 13 +------------ tripleoclient/v1/overcloud_upgrade.py | 7 +------ 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/tripleoclient/constants.py b/tripleoclient/constants.py index d02010254..62584b14f 100644 --- a/tripleoclient/constants.py +++ b/tripleoclient/constants.py @@ -30,7 +30,7 @@ MINION_LOG_FILE = "install-minion.log" UNDERCLOUD_ROLES_FILE = "roles_data_undercloud.yaml" STANDALONE_EPHEMERAL_STACK_VSTATE = '/var/lib/tripleo-heat-installer' UNDERCLOUD_LOG_FILE = "install-undercloud.log" -OVERCLOUD_NETWORKS_FILE = "network_data.yaml" +OVERCLOUD_NETWORKS_FILE = "network_data_default.yaml" OVERCLOUD_VIP_FILE = "vip_data_default.yaml" STANDALONE_NETWORKS_FILE = "/dev/null" UNDERCLOUD_NETWORKS_FILE = "network_data_undercloud.yaml" diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index 52871ec79..ae4ab74ec 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -1176,6 +1176,18 @@ class DeployOvercloud(command.Command): 'argument disables the protection, allowing the protected ' 'resource types to be override in the user environment.') ) + parser.add_argument( + '-y', '--yes', default=False, + action='store_true', + help=_('Use -y or --yes to skip any confirmation required before ' + 'the deploy operation. Use this with caution!') + ) + parser.add_argument( + '--allow-deprecated-network-data', default=False, + action='store_true', + help=_('Set this to allow using deprecated network data YAML ' + 'definition schema.') + ) return parser @@ -1184,6 +1196,19 @@ class DeployOvercloud(command.Command): logging.setup(CONF, '') self.log.debug("take_action(%s)" % parsed_args) + if (parsed_args.networks_file and + (not parsed_args.yes + and not parsed_args.allow_deprecated_network_data)): + if not utils.is_network_data_v2(parsed_args.networks_file): + confirm = utils.prompt_user_for_confirmation( + 'DEPRECATED network data definition {} provided. Please ' + 'update the network data definition to version 2.\n' + 'Do you still wish to continue with deployment [y/N]' + .format(parsed_args.networks_file), + self.log) + if not confirm: + raise oscexc.CommandError("Action not confirmed, exiting.") + if not parsed_args.working_dir: self.working_dir = utils.get_default_working_dir( parsed_args.stack) diff --git a/tripleoclient/v1/overcloud_update.py b/tripleoclient/v1/overcloud_update.py index b0574b28d..8f2d79a9b 100644 --- a/tripleoclient/v1/overcloud_update.py +++ b/tripleoclient/v1/overcloud_update.py @@ -43,12 +43,7 @@ class UpdatePrepare(DeployOvercloud): def get_parser(self, prog_name): parser = super(UpdatePrepare, self).get_parser(prog_name) - parser.add_argument('-y', '--yes', default=False, - action='store_true', - help=_("Use -y or --yes to skip the confirmation " - "required before any update operation. " - "Use this with caution! "), - ) + return parser def take_action(self, parsed_args): @@ -233,12 +228,6 @@ class UpdateConverge(DeployOvercloud): def get_parser(self, prog_name): parser = super(UpdateConverge, self).get_parser(prog_name) - parser.add_argument('-y', '--yes', default=False, - action='store_true', - help=_("Use -y or --yes to skip the confirmation " - "required before any update operation. " - "Use this with caution! "), - ) return parser diff --git a/tripleoclient/v1/overcloud_upgrade.py b/tripleoclient/v1/overcloud_upgrade.py index fabd9511f..c2873509b 100644 --- a/tripleoclient/v1/overcloud_upgrade.py +++ b/tripleoclient/v1/overcloud_upgrade.py @@ -48,12 +48,7 @@ class UpgradePrepare(DeployOvercloud): def get_parser(self, prog_name): parser = super(UpgradePrepare, self).get_parser(prog_name) - parser.add_argument('-y', '--yes', default=False, - action='store_true', - help=_("Use -y or --yes to skip the confirmation " - "required before any upgrade " - "operation. Use this with caution! "), - ) + return parser def take_action(self, parsed_args):