2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-21 11:12:04 +00:00

Merge pull request #6139 from bybai/eth_fix

fix configeth using nmcli connection name with space
This commit is contained in:
Gᴏɴɢ Jie 2019-03-21 13:14:34 +08:00 committed by GitHub
commit 2386723ddd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,7 +133,7 @@ function configipv4(){
fi
str_conf_file="/etc/sysconfig/network-scripts/ifcfg-${str_if_name}"
if [ $networkmanager_active -eq 1 ]; then
con_name=$(nmcli dev show ${str_if_name}|grep CONNECTION|awk -F: '{print $2}'|sed 's/^[ \t]*$//g')
con_name=$(nmcli -g CONNECTIONS dev show ${str_if_name}|awk -F"|" '{print $NF}'|sed 's/^[ \t]*//g')
if [ "$con_name" == "--" ] ; then
nmcli con add type ethernet con-name ${str_if_name} ifname ${str_if_name} ipv4.method manual ipv4.addresses ${str_v4ip}/${str_prefix}
else
@ -624,7 +624,7 @@ elif [ "$1" = "-s" ];then
str_inst_prefix=$(v4mask2prefix ${str_inst_mask})
str_conf_file="/etc/sysconfig/network-scripts/ifcfg-${str_inst_nic}"
if [ $networkmanager_active -eq 1 ]; then
con_name=$(nmcli dev show ${str_if_name}|grep CONNECTION|awk -F: '{print $2}'|sed 's/^[ \t]*$//g')
con_name=$(nmcli -g CONNECTIONS dev show ${str_if_name}|awk -F"|" '{print $NF}'|sed 's/^[ \t]*//g')
if [ "$con_name" == "--" ] ; then
nmcli con add type ethernet con-name ${str_inst_nic} ifname ${str_inst_nic} ipv4.method manual ipv4.addresses ${str_inst_ip}/${str_inst_prefix}
else