core: 云镜像配置文件,将dns单行数组换成多行数组,否则centos7/8会报错

This commit is contained in:
bin456789 2023-09-03 23:40:13 +08:00
parent 55df802f26
commit b44b8d90ab
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -612,7 +612,7 @@ network:
gateway4: $ipv4_gateway @ipv4_gateway
gateway6: $ipv6_gateway @ipv6_gateway
nameservers:
addresses: [@dns_addrs]
addresses: @dns_addrs
EOF
if is_dhcpv4 || [ -z "$ipv4_addr" ]; then
@ -637,20 +637,13 @@ EOF
dns6_list=$(echo "$dns_list" | grep ':' || true)
fi
unset dns_str
is_first=true
is_have_dns=false
for cur in $dns4_list $dns6_list; do
if $is_first; then
is_first=false
else
dns_str="$dns_str, "
fi
dns_str="$dns_str$cur"
is_have_dns=true
echo " - $cur" >>$ci_file
done
if [ -n "$dns_str" ]; then
sed -i "s/@dns_addrs/$dns_str/" $ci_file
else
if ! $is_have_dns; then
sed -i '/nameservers:/d' $ci_file
sed -i '/@dns_addrs/d' $ci_file
fi