Skip to content

Commit bb55183

Browse files
committed
update for ip change detection
1 parent 45e6ce2 commit bb55183

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/aznfswatchdogv4

+18-5
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,9 @@ process_nfsv4_mounts()
199199
# <IP>;<stunnel_account.file.preprod.core.windows.net.conf path>;<stunnel_account.file.preprod.core.windows.net.log path>;<stunnel_account.file.preprod.core.windows.net.pid path>;<checksumHash>;<status>;<timeout>
200200
#
201201
#daniewo #stunnel_account here is the destination IP address for the account.
202+
#FSLOCATION will have FQDN IP1 IP2 or something like that. Look for IP1 and see if it's different than IP2
202203

203-
IFS=";" read l_ip l_conf l_log l_pid l_checksumhash l_status l_timeout <<< "$line"
204+
IFS=";" read l_ip l_conf l_log l_pid l_checksumhash l_status l_timeout <<< "$line"
204205

205206
if [ -z "$l_ip" -o -z "$l_conf" -o -z "$l_pid" ]; then
206207
wecho "[FATAL] Deleting invalid line in $MOUNTMAPv4: [$line]!"
@@ -247,13 +248,25 @@ process_nfsv4_mounts()
247248
#if IP is updated, then reconfigure stunnel and probably go to last step and skip this. or move this check
248249
# above
249250

250-
#daniewo get dest ip from mountmap file
251-
ip_address=$(echo $l_conf | awk -F'.file' '{print $1}')
252-
echo "The extracted IP address is: $ip_address"
251+
# #daniewo get dest ip from mountmap file
252+
# ip_address=$(echo $l_conf | awk -F'.file' '{print $1}')
253+
# echo "The extracted IP address is: $ip_address"
253254

254255
#get matching ip address from fs location entry for the account name FQDN
255-
local fslocation_entry=$(grep -m1 $l_host $VIRTUALFSLOCATION)
256+
local fslocation_entry=$(grep $l_ip $VIRTUALFSLOCATION)
256257
#probably need to check if it returns empty as well.
258+
#we grab the entire lines, for each entry etc.
259+
for entry in $fslocation_entry; do
260+
eecho "daniewo fslocation_entry = $entry"
261+
262+
#extract fslocation entry
263+
IFS=" " read l_fqdn old_ip new_ip l_prt <<< $fslocation_entry
264+
eecho "daniewo $l_fqdn, $old_ip, $new_ip, $l_prt"
265+
#if old ip != new ip, then reconfigure files
266+
if [ "$l_ip" != "$new_ip" ]; then
267+
eecho "daniewo -------------- IP CHANGED -----------"
268+
fi
269+
done
257270

258271
eecho "daniewo fslocation_entry = $fslocation_entry"
259272

0 commit comments

Comments
 (0)