From: Litao Gao Date: Fri, 8 May 2020 06:44:54 +0000 (-0400) Subject: stx-puppet: fix the unnecessary network configuration apply X-Git-Tag: bronze-rc0~24 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=1c6cda1f5b2b7e3566f30191e4c97041b15933b9;p=pti%2Frtp.git stx-puppet: fix the unnecessary network configuration apply In AIO case, both controller and worker will run network puppet to apply network configuration, need to check and avoid unnecessary apply to avoid the potential conflicts. Issue-ID: INF-94 Signed-off-by: Litao Gao Change-Id: I0372dd669b00a0969b5cddc0df3d9576092d564a --- diff --git a/meta-stx/recipes-support/puppet/files/stx-puppet/apply_network_config_poky.sh b/meta-stx/recipes-support/puppet/files/stx-puppet/apply_network_config_poky.sh index 9d182be..8357378 100755 --- a/meta-stx/recipes-support/puppet/files/stx-puppet/apply_network_config_poky.sh +++ b/meta-stx/recipes-support/puppet/files/stx-puppet/apply_network_config_poky.sh @@ -280,16 +280,23 @@ function sysinv_agent_lock { # synchronize with sysinv-agent audit sysinv_agent_lock $ACQUIRE_LOCK -# now copy the puppet changed interfaces to /etc/network/interfaces -do_mv /var/run/interfaces.puppet /etc/network/interfaces - -# now restart networking service -/etc/init.d/networking restart +# check if this is a duplicated configuration +if ! diff -I '^#' "/var/run/interfaces.puppet" "/etc/network/interfaces" > /dev/null; then + # now copy the puppet changed interfaces to /etc/network/interfaces + do_mv /var/run/interfaces.puppet /etc/network/interfaces + + # now restart networking service + /etc/init.d/networking restart + + sleep 5 +else + # need to remove this file also + do_rm /var/run/interfaces.puppet +fi -sleep 5 # workaround the loopback label addresses cannot be configured as scope of host -ip addr show lo | egrep "inet.*lo:" > /tmp/loop$$ +ip addr show lo | egrep "inet.*global.*lo:" > /tmp/loop$$ while read addr_info; do echo $addr_info