|
65 | 65 |
|
66 | 66 | netplan apply |
67 | 67 |
|
68 | | -if [[ $NICS_NUM -gt 1 ]]; then |
69 | | - are_routes_ready='ip route | grep eth1' |
70 | | - for(( i=2; i<$NICS_NUM; i++ )); do |
71 | | - are_routes_ready=$are_routes_ready' && ip route | grep eth'"$i" |
72 | | - done |
73 | | -cat >>/usr/sbin/remove-routes.sh <<EOF |
74 | | -#!/bin/bash |
75 | | -set -ex |
76 | | -retry_max=24 |
77 | | -for(( i=0; i<\$retry_max; i++ )); do |
78 | | - if eval "$are_routes_ready"; then |
79 | | - for(( j=1; j<$NICS_NUM; j++ )); do |
80 | | - /usr/sbin/ip route del $SUBNET_RANGE dev eth\$j |
81 | | - done |
82 | | - break |
83 | | - fi |
84 | | - ip route |
85 | | - sleep 5 |
86 | | -done |
87 | | -if [ \$i -eq \$retry_max ]; then |
88 | | - echo "Routes are not ready on time" |
89 | | - host_routes=$(ip route) |
90 | | - weka_resources=$(weka local resources || "no weka resources") |
91 | | - report "{\"hostname\": \"$HOSTNAME\", \"type\": \"error\", \"message\": \"Routes are not ready on time. Routes: $host_routes WEKA resources: $weka_resources\"}" |
92 | | - shutdown -h now |
93 | | - exit 1 |
94 | | -fi |
95 | | -echo "Routes were removed successfully" |
96 | | -EOF |
97 | | -
|
98 | | - chmod +x /usr/sbin/remove-routes.sh |
99 | | -
|
100 | | -cat >/etc/systemd/system/remove-routes.service <<EOF |
101 | | -[Unit] |
102 | | -Description=Remove specific routes |
103 | | -After=network-online.target |
104 | | -Wants=network-online.target |
105 | | -
|
106 | | -[Service] |
107 | | -Type=oneshot |
108 | | -ExecStart=/bin/bash /usr/sbin/remove-routes.sh |
109 | | -
|
110 | | -[Install] |
111 | | -WantedBy=multi-user.target |
112 | | -EOF |
113 | | -
|
114 | | - ip route # show routes before removing |
115 | | - systemctl daemon-reload |
116 | | - systemctl enable remove-routes.service |
117 | | - systemctl start remove-routes.service |
118 | | - systemctl status remove-routes.service || true # show status of remove-routes.service |
119 | | - ip route # show routes after removing |
120 | | -fi |
121 | | -
|
122 | | -echo "$(date -u): routes configured" |
123 | | -
|
124 | 68 | disk_size_str="${DISK_SIZE}G" |
125 | 69 | while ! [ "$(lsblk | grep $disk_size_str | awk '{print $1}')" ] ; do |
126 | 70 | echo "waiting for disk to be ready" |
@@ -165,11 +109,19 @@ if [ $retry -gt 0 ]; then |
165 | 109 | report "{\"hostname\": \"$HOSTNAME\", \"type\": \"debug\", \"message\": \"$msg\"}" |
166 | 110 | fi |
167 | 111 |
|
| 112 | +# debug info |
| 113 | +ip route |
| 114 | +ip addr show |
| 115 | +
|
168 | 116 | echo "$(date -u): running deploy script" |
169 | 117 |
|
170 | 118 | chmod +x /tmp/deploy.sh |
171 | 119 | /tmp/deploy.sh 2>&1 | tee /tmp/weka_deploy.log |
172 | 120 |
|
| 121 | +# debug info |
| 122 | +ip route |
| 123 | +ip addr show |
| 124 | +
|
173 | 125 | # Install WEKA maintenance event monitor |
174 | 126 | echo "$(date -u): installing weka maintenance event monitor" |
175 | 127 |
|
|
0 commit comments