Fail cfg01 bootstrap if the bootstrap script is failed

Change-Id: I11f3f5c81257bdb0bf0ec5af36be0aaa92af5065
diff --git a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay--user-data-cfg01.yaml b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay--user-data-cfg01.yaml
index 77c18d1..4b134b7 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay--user-data-cfg01.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay--user-data-cfg01.yaml
@@ -61,19 +61,19 @@
    #- cp /root/config-drive/user-data /root/user-data
    #- sed -i '/^reboot$/d' /root/user-data
    #- set -x; cd /root && /bin/bash -xe ./user-data
-   - set -x; cd /root/config-drive && /bin/bash -xe ./user-data
-
-   #- echo "nameserver 172.18.208.44" >> /etc/resolv.conf;
+   - |
+     set -x
+     cd /root/config-drive
+     if /bin/bash -xe ./user-data > /var/log/cloud-init-user-data.log; then
+         touch /is_cloud_init_finished
+     else
+         set +x
+         echo "bootstrap script /root/config-drive/user-data failed. tail -n 10 /var/log/cloud-init-user-data.log:\n" > /is_cloud_init_failed
+         tail -n 10 /var/log/cloud-init-user-data.log >> /is_cloud_init_failed
+     fi
 
    # Enable root access (after reboot)
    - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
-   #- service sshd stop
-
-   ########################################################
-   # Node is ready, allow SSH access
-   - touch /is_cloud_init_finished
-   #- reboot
-   ########################################################
 
   write_files:
    - path: /etc/default/grub.d/97-enable-grub-menu.cfg