Merge "Remove conditional for neutron l3_ha"
[apex-tripleo-heat-templates.git] / overcloud.j2.yaml
index 70d70f7..f3a7126 100644 (file)
@@ -231,8 +231,19 @@ resources:
       config: {get_attr: [allNodesConfig, config_id]}
       servers: {get_attr: [{{role.name}}, attributes, nova_server_resource]}
       input_values:
-        bootstrap_nodeid: {get_attr: [{{role.name}}, resource.0.hostname]}
-        bootstrap_nodeid_ip: {get_attr: [{{role.name}}, resource.0.ip_address]}
+        # Note we have to use yaql to look up the first hostname/ip in the
+        # list because heat path based attributes operate on the attribute
+        # inside the ResourceGroup, not the exposed list ref discussion in
+        # https://bugs.launchpad.net/heat/+bug/1640488
+        # The coalesce is needed because $.data is None during heat validation
+        bootstrap_nodeid:
+          yaql:
+            expression: coalesce($.data, []).first(null)
+            data: {get_attr: [{{role.name}}, hostname]}
+        bootstrap_nodeid_ip:
+          yaql:
+            expression: coalesce($.data, []).first(null)
+            data: {get_attr: [{{role.name}}, ip_address]}
 
   {{role.name}}AllNodesValidationDeployment:
     type: OS::Heat::StructuredDeployments
@@ -299,7 +310,7 @@ resources:
               # - The outer one filters the map based on the services enabled for the role
               #   then merges the result into one map.
               - yaql:
-                  expression: let(root => $) -> $.data.map.items().where($[0] in $root.data.services).select($[1]).reduce($1.mergeWith($2), {})
+                  expression: let(root => $) -> $.data.map.items().where($[0] in coalesce($root.data.services, [])).select($[1]).reduce($1.mergeWith($2), {})
                   data:
                     map:
                       yaql:
@@ -531,8 +542,8 @@ resources:
   # Post deployment steps for all roles
   AllNodesDeploySteps:
     type: OS::TripleO::PostDeploySteps
-{% for role in roles %}
     depends_on:
+{% for role in roles %}
       - {{role.name}}AllNodesDeployment
 {% endfor %}
     properties: