File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1111echo $HOSTNAME > /etc/hostname
1212hostname -F /etc/hostname
1313
14+ # Don't update the /etc/hosts if hostname is not changed
15+ # This is to prevent intermittent redis_chassis.server reachability issue
16+ if [ $CURRENT_HOSTNAME == $HOSTNAME ] ; then
17+ exit 0
18+ fi
19+
1420# Remove the old hostname entry from hosts file.
1521# But, 'localhost' entry is used by multiple applications. Don't remove it altogether.
1622# Edit contents of /etc/hosts and put in /etc/hosts.new
17- if [ $CURRENT_HOSTNAME != " localhost" ] || [ $CURRENT_HOSTNAME == $HOSTNAME ] ; then
23+ if [ $CURRENT_HOSTNAME != " localhost" ] ; then
1824 sed " /\s$CURRENT_HOSTNAME $/d" /etc/hosts > /etc/hosts.new
1925else
2026 cp -f /etc/hosts /etc/hosts.new
Original file line number Diff line number Diff line change @@ -132,12 +132,23 @@ function clean_up_chassis_db_tables()
132132 return
133133 fi
134134
135- if [[ ! ( $( $SONIC_DB_CLI CHASSIS_APP_DB PING | grep -c True) -gt 0) ]]; then
136- return
137- fi
135+ until [[ $( $SONIC_DB_CLI CHASSIS_APP_DB PING | grep -c True) -gt 0 ]]; do
136+ sleep 1
137+ done
138138
139139 lc=` $SONIC_DB_CLI CONFIG_DB hget ' DEVICE_METADATA|localhost' ' hostname' `
140+ until [[ -n " ${lc} " ]]; do
141+ lc=` $SONIC_DB_CLI CONFIG_DB hget ' DEVICE_METADATA|localhost' ' hostname' `
142+ sleep 1
143+ done
144+ debug " Chassis db clean up for ${SERVICE} $DEV . hostname=$lc "
145+
140146 asic=` $SONIC_DB_CLI CONFIG_DB hget ' DEVICE_METADATA|localhost' ' asic_name' `
147+ until [[ -n " ${asic} " ]]; do
148+ asic=` $SONIC_DB_CLI CONFIG_DB hget ' DEVICE_METADATA|localhost' ' asic_name' `
149+ sleep 1
150+ done
151+ debug " Chassis db clean up for ${SERVICE} $DEV . asic=$asic "
141152
142153 # First, delete SYSTEM_NEIGH entries
143154 num_neigh=` $SONIC_DB_CLI CHASSIS_APP_DB EVAL "
You can’t perform that action at this time.
0 commit comments