Optimize redundent code fetching server of network dump

Code in function kdump_install_net used to get server of network dump
is is a little redundent, can be optimized into one line. For nfs/ssh,
this line of code is enough.

Test passed on local kvm guest with Fedora 18.

Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Baoquan He 2012-12-13 14:17:26 +08:00 committed by Dave Young
parent 3be6c1228e
commit 4590f6e33b

View File

@ -165,11 +165,7 @@ kdump_install_net() {
local _server _netdev
local config_val="$1"
if strstr "$config_val" "@"; then
_server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
else
_server=$(echo $config_val | sed -e 's#\(.*\):.*#\1#')
fi
_server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
_need_dns=`echo $_server|grep "[a-zA-Z]"`
[ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`