This commit is contained in:
saksarav-nokia 2024-03-25 14:13:00 -07:00 committed by GitHub
commit 5c8c833ef3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 4 deletions

View File

@ -11,10 +11,16 @@ fi
echo $HOSTNAME > /etc/hostname
hostname -F /etc/hostname
#Don't update the /etc/hosts if hostname is not changed
#This is to prevent intermittent redis_chassis.server reachability issue
if [ $CURRENT_HOSTNAME == $HOSTNAME ] ; then
exit 0
fi
# Remove the old hostname entry from hosts file.
# But, 'localhost' entry is used by multiple applications. Don't remove it altogether.
# Edit contents of /etc/hosts and put in /etc/hosts.new
if [ $CURRENT_HOSTNAME != "localhost" ] || [ $CURRENT_HOSTNAME == $HOSTNAME ] ; then
if [ $CURRENT_HOSTNAME != "localhost" ] ; then
sed "/\s$CURRENT_HOSTNAME$/d" /etc/hosts > /etc/hosts.new
else
cp -f /etc/hosts /etc/hosts.new

View File

@ -132,12 +132,23 @@ function clean_up_chassis_db_tables()
return
fi
if [[ !($($SONIC_DB_CLI CHASSIS_APP_DB PING | grep -c True) -gt 0) ]]; then
return
fi
until [[ $($SONIC_DB_CLI CHASSIS_APP_DB PING | grep -c True) -gt 0 ]]; do
sleep 1
done
lc=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' 'hostname'`
until [[ -n "${lc}" ]]; do
lc=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' 'hostname'`
sleep 1
done
debug "Chassis db clean up for ${SERVICE}$DEV. hostname=$lc"
asic=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' 'asic_name'`
until [[ -n "${asic}" ]]; do
asic=`$SONIC_DB_CLI CONFIG_DB hget 'DEVICE_METADATA|localhost' 'asic_name'`
sleep 1
done
debug "Chassis db clean up for ${SERVICE}$DEV. asic=$asic"
# First, delete SYSTEM_NEIGH entries
num_neigh=`$SONIC_DB_CLI CHASSIS_APP_DB EVAL "