Add handling for roles and networks to answers

The answers file only supports environments and templates today.
This change adds handling for roles and networks arguments. This
change will allow users to specify their roles_data.yaml and
network_data.yaml file in the same location as their other custom
templates.

Conflicts:
	tripleoclient/v1/overcloud_deploy.py

Resolved conflicts caused by the refactoring done in
dc8b39adf0

Change-Id: I905999fd7901490aa87d3ab302b28b437225ed89
(cherry picked from commit f931e73c47)
This commit is contained in:
Brendan Shephard 2022-06-08 09:55:51 +10:00 committed by Takashi Kajinami
parent b224e0b4f3
commit 88d025d027
2 changed files with 23 additions and 9 deletions

View File

@ -0,0 +1,6 @@
---
features:
- |
Users can now specify roles_data.yaml and network_data.yaml locations
in their answers file. Using `networks` and `roles` along with their
`templates` and `environments` arguments.

View File

@ -64,16 +64,24 @@ class DeployOvercloud(command.Command):
parsed_args.deployed_server = True
def _update_args_from_answers_file(self, args):
if args.answers_file is not None:
with open(args.answers_file, 'r') as answers_file:
answers = yaml.safe_load(answers_file)
if args.answers_file is None:
return
if args.templates is None:
args.templates = answers['templates']
if 'environments' in answers:
if args.environment_files is not None:
answers['environments'].extend(args.environment_files)
args.environment_files = answers['environments']
with open(args.answers_file, 'r') as answers_file:
answers = yaml.safe_load(answers_file)
if args.templates is None:
args.templates = answers['templates']
if 'environments' in answers:
if args.environment_files is not None:
answers['environments'].extend(args.environment_files)
args.environment_files = answers['environments']
if 'roles' in answers:
if args.roles_file is None:
args.roles_file = answers['roles']
if 'networks' in answers:
if args.networks_file is None:
args.networks_file = answers['networks']
def _update_parameters(self, args, parameters,
tht_root, user_tht_root):