2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-31 01:56:39 +00:00

Merge pull request #6755 from cxhong/configeth

Lost DNS after run confignetwork -s postscripts
This commit is contained in:
besawn 2020-07-10 16:03:47 -04:00 committed by GitHub
commit 08848a1b14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -524,6 +524,7 @@ elif [ "$1" = "-s" ];then
str_inst_mask=''
str_inst_gateway=''
str_inst_mtu=''
str_inst_dns=''
if [ "$str_os_type" = "aix" ];then
log_error "configeth on $NODE: aix does not support -s flag"
exit 1
@ -578,6 +579,7 @@ elif [ "$1" = "-s" ];then
str_inst_ip=`grep fixed-address $str_lease_file | tail -n 1 | awk '{print $2}' | sed 's/;$//'`
str_inst_mask=`grep subnet-mask $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
str_inst_dns=`grep domain-name-servers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
else
if [ -n "$MACADDRESS" ];then
str_inst_mac=$MACADDRESS
@ -734,6 +736,11 @@ elif [ "$1" = "-s" ];then
if [ $networkmanager_active -eq 2 ]; then
echo "AUTOCONNECT_PRIORITY=9" >> $str_conf_file
fi
if [ -n "${str_inst_dns}" ];then
if [ $networkmanager_active -eq 1 ]; then
nmcli con modify $con_name ipv4.dns ${str_inst_dns}
fi
fi
if [ -n "${str_inst_mtu}" ];then
if [ $networkmanager_active -eq 1 ]; then
nmcli con modify $con_name mtu ${str_inst_mtu}