Merge "When executing upgrade bootstrap for AIO-SX only update /etc/network/"

This commit is contained in:
Zuul 2023-09-20 15:18:04 +00:00 committed by Gerrit Code Review
commit ffd09b26de
2 changed files with 37 additions and 2 deletions

View File

@ -316,8 +316,13 @@ else
parse_interface_stanzas
update_interfaces
update_routes
if [[ ! -f /var/run/.network_upgrade_bootstrap ]]; then
update_interfaces
update_routes
else
log_it "Executing upgrade bootstrap, just add the config files into /etc/network/"
update_config
fi
else
log_it "Not using sysconfig or ifupdown, cannot advance! Aborting..."

View File

@ -626,3 +626,33 @@ function update_routes {
do_cp ${PUPPET_ROUTES_FILE} ${ETC_ROUTES_FILE}
fi
}
function update_config {
# process interfaces
auto_puppet=( $(grep -v HEADER ${PUPPET_DIR}/auto) )
for auto_if in ${auto_puppet[@]:1}; do
cfg="ifcfg-${auto_if}"
do_cp ${PUPPET_DIR}/${cfg} ${ETC_DIR}/${cfg}
done
do_cp ${PUPPET_DIR}/auto ${ETC_DIR}/auto
# process routes
if [ -f ${PUPPET_ROUTES6_FILE} ]; then
log_it "add IPv6 routes generated in network.pp"
if [ -f ${PUPPET_ROUTES_FILE} ]; then
puppet_data=$(grep -v HEADER ${PUPPET_ROUTES6_FILE})
while read route6Line; do
route_exists=$( grep -E "${route6Line}" ${PUPPET_ROUTES_FILE} )
if [ "${route_exists}" == "" ]; then
echo "${route6Line}" >> ${PUPPET_ROUTES_FILE}
fi
done <<< ${puppet_data}
else
cat ${PUPPET_ROUTES6_FILE} >> ${PUPPET_ROUTES_FILE}
fi
fi
if [ -f ${PUPPET_ROUTES_FILE} ]; then
do_cp ${PUPPET_ROUTES_FILE} ${ETC_ROUTES_FILE}
fi
}