diff options
-rwxr-xr-x | sysconfig/network-scripts/ifup | 8 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index d9095dc7..cc5efc97 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -65,12 +65,8 @@ then exit 0 fi -if [ "$USE_NM" = "true" -a -n "$NAME" -o -n "$UUID" ]; then - if [ -n "$UUID" ]; then - nmcli con up uuid "$UUID" - elif [ -n "$NAME" ]; then - nmcli con up id "$NAME" - fi +if [ "$USE_NM" = "true" -a -n "$UUID" ]; then + nmcli con up uuid "$UUID" exit $? fi diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index de884ec3..e498553b 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -54,6 +54,11 @@ get_device_by_hwaddr () LANG=C ip -o link | grep -v link/ieee802.11 | awk -F ': ' -vIGNORECASE=1 "/$1/ { print \$2 }" } +get_uuid_by_config () +{ + dbus-send --system --print-reply --dest=com.redhat.ifcfgrh1 /com/redhat/ifcfgrh1 com.redhat.ifcfgrh1.GetIfcfgDetails string:"/etc/sysconfig/network-scripts/$1" | awk -F '"' '/string / { print $2 }' +} + need_config () { local nconfig @@ -139,9 +144,8 @@ source_config () ISALIAS=no fi is_nm_running && USE_NM=true - if [ -z "$NAME" -a "$USE_NM" = "true" ]; then - UUID=$(nmcli -t con list id "System ${DEVICE}" 2>/dev/null| awk '/uuid :/ { print gensub("\"","","g",$3) }') - [ -n "$UUID" ] && NAME="System ${DEVICE}" + if [ -z "$UUID" -a "$USE_NM" = "true" ]; then + UUID=$(get_uuid_by_config $CONFIG) fi } |