Browse Source

config-download: rename pre/post deployment hostvars

We can't have numbers starting an Ansible var, so we need to rename the
pre/post deployments host vars, or we hit this error:
  template error while templating string: expected token 'end of print statement'

https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#creating-valid-variable-names

In this patch we have to duplicate host vars but it'll be cleaned up
once we change to the new file in THT.

Change-Id: Idbdd6a21eb2cd488daa1e3ddc844b4fc5267047c
Related-Bug: #1842141
(cherry picked from commit 21754e9987)
(cherry picked from commit 44da685cb0)
tags/9.6.1^0
Emilien Macchi 2 weeks ago
parent
commit
74991a643a

+ 14
- 0
tripleo_common/templates/group_var_role.j2 View File

@@ -3,12 +3,26 @@
3 3
   - {{ deployment }}
4 4
 {% endfor %}
5 5
 
6
+# Temporary duplication
7
+# https://bugs.launchpad.net/tripleo/+bug/1842141
8
+pre_deployments_{{ role }}: {% if not pre_deployments %} [] {% endif %}
9
+
10
+{% for deployment in pre_deployments %}
11
+  - {{ deployment }}
12
+{% endfor %}
13
+
6 14
 {{ role }}_post_deployments: {% if not post_deployments %} [] {% endif %}
7 15
 
8 16
 {% for deployment in post_deployments %}
9 17
   - {{ deployment }}
10 18
 {% endfor %}
11 19
 
20
+post_deployments_{{ role }}: {% if not post_deployments %} [] {% endif %}
21
+
22
+{% for deployment in post_deployments %}
23
+  - {{ deployment }}
24
+{% endfor %}
25
+
12 26
 {%  for k,v in role_group_vars.items() %}
13 27
 {{ k }}: {{ v }}
14 28
 {%  endfor %}

+ 8
- 0
tripleo_common/tests/utils/data/Compute View File

@@ -6,5 +6,13 @@ Compute_pre_deployments:
6 6
 
7 7
 Compute_post_deployments:  []
8 8
 
9
+pre_deployments_Compute:
10
+  - ComputeHostEntryDeployment
11
+  - NetworkDeployment
12
+  - MyExtraConfigPost
13
+  - AnsibleDeployment
14
+
15
+post_deployments_Compute:  []
16
+
9 17
 max_fail_percentage: 15
10 18
 any_errors_fatal: yes

+ 8
- 0
tripleo_common/tests/utils/data/Controller View File

@@ -6,5 +6,13 @@ Controller_pre_deployments:
6 6
 
7 7
 Controller_post_deployments:  []
8 8
 
9
+pre_deployments_Controller:
10
+  - ControllerHostEntryDeployment
11
+  - NetworkDeployment
12
+  - MyPostConfig
13
+  - MyExtraConfigPost
14
+
15
+post_deployments_Controller:  []
16
+
9 17
 max_fail_percentage: 15
10 18
 any_errors_fatal: yes

Loading…
Cancel
Save