Cleanup previous files for puppet network runtime execution

Some networks (OAM, for AIO-SX, and ADMIN) support network runtime
configuration, meaning that they do not require a lock/unlock cycle.

It was observed that the previously generated files were not removed:
in network_ifupdown.sh the use of wildcard "ifcfg-*" to a function
was not expanding as an argument inside of do_rm(), preventing the
removal, and the puppet-network plugin (responsible to generate the
interfaces file) was concatenating its content with the previous one.

This change corrects this errors by explicitly removing the files.

Test Plan
[PASS] Install AIO-SX in single-stack and then add dual-stack config
       for OAM network in runtime and observe that there is no traffic
       interruption as the secondary address is added
[PASS] Install AIO-DX in single-stack with the following variants:
       - ethernet port with {mgmt, cluster-host, pxeboot} networks
       - ethernet port with pxeboot and vlan with {mgmt, cluster-host}
          networks
       - bonding port with {mgmt, cluster-host, pxeboot} networks
       - bonding port with pxeboot and vlan with {mgmt, cluster-host}
          networks

Story: 2011027
Task: 50055

Change-Id: I85c218e230d392ee1aa4097d089acc18e8bbbc89
Signed-off-by: Andre Kantek <andrefernandozanella.kantek@windriver.com>
This commit is contained in:
Andre Kantek 2024-05-08 07:53:08 -03:00
parent c4666d214a
commit 074cc9cc3f
2 changed files with 12 additions and 3 deletions

View File

@ -86,8 +86,10 @@ function parse_interface_stanzas {
local last_generated=''
local puppet_data
do_rm ${PUPPET_DIR}/auto
do_rm ${PUPPET_DIR}/ifcfg-\*
log_it info "remove ${PUPPET_DIR}/auto"
rm -f ${PUPPET_DIR}/auto
log_it info "remove ${PUPPET_DIR}/ifcfg-*"
rm -f ${PUPPET_DIR}/ifcfg-*
is_iface=$(false)
is_auto=$(false)

View File

@ -654,7 +654,8 @@ class platform::network::apply {
include ::platform::network::addresses
include ::platform::network::routes
Network_config <| |>
Exec['cleanup-interfaces-file']
-> Network_config <| |>
-> Exec['apply-network-config']
-> Platform::Network::Network_address <| |>
-> Exec['wait-for-tentative']
@ -685,6 +686,12 @@ class platform::network::apply {
try_sleep => 1,
onlyif => 'test ! -f /var/run/.network_upgrade_bootstrap',
}
exec { 'cleanup-interfaces-file':
command => 'rm -f /var/run/network-scripts.puppet/interfaces && touch /var/run/network-scripts.puppet/interfaces',
logoutput => true,
onlyif => 'test -f /var/run/network-scripts.puppet/interfaces',
}
}