Fix stack readiness

The patch reworks heat templates to ensure stack is ready
only when all nodes are bootstrapped and wait conditions
are completed.

Related-Prod: PRODX-2063
Change-Id: I03905a80c05ab5933d8641529f97afe4d0097825
diff --git a/de/heat-templates/top.yaml b/de/heat-templates/top.yaml
index 7051873..f6a5e6f 100644
--- a/de/heat-templates/top.yaml
+++ b/de/heat-templates/top.yaml
@@ -84,17 +84,6 @@
       enable_dhcp: false
       gateway_ip: ~
 
-  ucp_config:
-    type: OS::Heat::SoftwareConfig
-    properties:
-      group: ungrouped
-      config:
-        str_replace:
-          template: { get_file: ./scripts/instance_boot.sh }
-          params:
-            $node_type: ucp
-            $wait_condition_notify: { get_attr: [ ucp_wait_handle, curl_cli ] }
-            $ucp_license_key: { get_file: ./scripts/license.lic }
   ucp:
     depends_on: router_iface
     type: ./srv-group.yaml
@@ -106,34 +95,13 @@
       private_net_id: { get_resource: network }
       private_subnet_id: { get_resource: subnet }
       private_floating_network: { get_resource: private_floating_network }
-      user_data: { get_resource: ucp_config }
       metadata: {"role":"ucp"}
-
-  ucp_wait_handle:
-    type: OS::Heat::WaitConditionHandle
-  ucp_wait_condition:
-    type: OS::Heat::WaitCondition
-    properties:
-      handle: { get_resource: ucp_wait_handle }
-      timeout: { get_param: ucp_boot_timeout }
-
-  master_config:
-    type: OS::Heat::SoftwareConfig
-    properties:
-      group: ungrouped
-      config:
-        str_replace:
-          template: { get_file: ./scripts/instance_boot.sh }
-          params:
-            $node_type: master
-            $wait_condition_notify: { get_attr: [ ucp_wait_handle, curl_cli ] }
-            $ucp_license_key: { get_file: ./scripts/license.lic }
-            $ucp_master_host: { get_attr: [ucp, server_private_ip] }
+      node_type: "ucp"
 
   masters:
     type: OS::Heat::ResourceGroup
     depends_on:
-     - ucp_wait_condition
+     - ucp
     properties:
       count: { get_param: masters_size }
       resource_def:
@@ -146,26 +114,14 @@
           private_net_id: { get_resource: network }
           private_subnet_id: { get_resource: subnet }
           private_floating_network: { get_resource: private_floating_network }
-          user_data: { get_resource: master_config }
           metadata: {"role":"master"}
-
-  worker_config:
-    type: OS::Heat::SoftwareConfig
-    properties:
-      group: ungrouped
-      config:
-        str_replace:
-          template: { get_file: ./scripts/instance_boot.sh }
-          params:
-            $node_type: worker
-            $wait_condition_notify: { get_attr: [ ucp_wait_handle, curl_cli ] }
-            $ucp_license_key: { get_file: ./scripts/license.lic }
-            $ucp_master_host: { get_attr: [ucp, server_private_ip] }
+          node_type: "master"
+          ucp_master_host: { get_attr: [ucp, server_private_ip] }
 
   workers:
     type: OS::Heat::ResourceGroup
     depends_on:
-     - ucp_wait_condition
+     - ucp
     properties:
       count: { get_param: worker_size }
       resource_def:
@@ -178,12 +134,14 @@
           private_net_id: { get_resource: network }
           private_subnet_id: { get_resource: subnet }
           private_floating_network: { get_resource: private_floating_network }
-          user_data: { get_resource: worker_config }
           metadata: { get_param: worker_metadata}
+          node_type: "worker"
+          ucp_master_host: { get_attr: [ucp, server_private_ip] }
+
   cmps:
     type: OS::Heat::ResourceGroup
     depends_on:
-     - ucp_wait_condition
+     - ucp
     properties:
       count: { get_param: cmp_size }
       resource_def:
@@ -196,12 +154,14 @@
           private_net_id: { get_resource: network }
           private_subnet_id: { get_resource: subnet }
           private_floating_network: { get_resource: private_floating_network }
-          user_data: { get_resource: worker_config }
           metadata: { get_param: cmp_metadata}
+          node_type: "worker"
+          ucp_master_host: { get_attr: [ucp, server_private_ip] }
+
   gtws:
     type: OS::Heat::ResourceGroup
     depends_on:
-     - ucp_wait_condition
+     - ucp
     properties:
       count: { get_param: gtw_size }
       resource_def:
@@ -214,8 +174,9 @@
           private_net_id: { get_resource: network }
           private_subnet_id: { get_resource: subnet }
           private_floating_network: { get_resource: private_floating_network }
-          user_data: { get_resource: worker_config }
           metadata: { get_param: gtw_metadata}
+          node_type: "worker"
+          ucp_master_host: { get_attr: [ucp, server_private_ip] }
 
 
 outputs: