Ensure files exist before building/uploading plan

Until now, only environment files were tested for their eXistenZ. This
patch corrects this issue, allowing to get a graceful failure before
plan is compiled and uploaded.

The following files are now checked, and deploy will gracefully fail in
case of non-existing file:
- plan-environment-file
- answers-file
- networks-file

No Bioport nor Pod was harmed for this patch.

Change-Id: Ifd4229b68571fd6b91574675c1f04d7b5c755eab
Closes-Bug: #1834307
(cherry picked from commit bd354f1fc8)
(cherry picked from commit f78809a3e3)
(cherry picked from commit cb976f6729)
This commit is contained in:
Cédric Jeanneret 2019-06-26 11:24:14 +02:00 committed by Cédric Jeanneret (Tengu)
parent e717083e2a
commit 9e5ec97754
1 changed files with 16 additions and 0 deletions

View File

@ -592,6 +592,22 @@ class DeployOvercloud(command.Command):
if not os.path.isfile(env_file.replace(".yaml",
".j2.yaml")):
nonexisting_envs.append(env_file)
# Check networks_file existence
if parsed_args.networks_file:
if not os.path.isfile(parsed_args.networks_file):
nonexisting_envs.append(parsed_args.networks_file)
# check plan_environment_file existence
if parsed_args.plan_environment_file:
if not os.path.isfile(parsed_args.plan_environment_file):
nonexisting_envs.append(parsed_args.plan_environment_file)
# check answers_file existence
if parsed_args.answers_file:
if not os.path.isfile(parsed_args.answers_file):
nonexisting_envs.append(parsed_args.answers_file)
if jinja2_envs:
rewritten_paths = [e.replace(".j2.yaml", ".yaml")
for e in jinja2_envs]