Only concatenate default_templates_dir when necessary

By default the default_templates_dir is appended to the
plan_environment file. This is fine unless the deployer
overrides the default plan_environment file with the -p
option. This patch adds jinja2 filters so that if the
plan_environment starts with a '/', then the default
templates directory is not appended. Otherwise the default
behavior is unchanged.

Change-Id: I5341da7fdea0a53b86295d74d68ef2013efb0ea0
Closes-Bug: #1893861
(cherry picked from commit 295555839c)
This commit is contained in:
John Fulton 2020-09-01 21:38:01 -04:00
parent 17e6d8c82b
commit a7b611f5a9
1 changed files with 8 additions and 2 deletions

View File

@ -90,12 +90,18 @@
when: use_default_templates or source_url is not none
- name: Create plan environment if does not exit
# If plan_environment is an absolute path, then
# don't prepend the templates dir. Else prepend it.
- name: Create plan environment if does not exist
os_object:
container: "{{ container }}"
name: plan-environment.yaml
filename: "{{ default_templates_dir + plan_environment }}"
state: present
filename: >-
{{ plan_environment.startswith('/')
| ternary(plan_environment,
default_templates_dir.rstrip('/')
+ '/' + plan_environment) }}
- name: Generate passwords and update plan
tripleo_passwords_rotate: