testing: ssh script accepts IP addresses instead of host names

This commit is contained in:
Tobias Brunner 2013-03-04 11:55:26 +01:00
parent 5057455674
commit 45ee7c9429

View File

@ -10,12 +10,19 @@ then
fi
host=$1
echo "$host" | grep -q "^\([0-9]\+\.\|[0-9a-fA-F]\+:\).*"
if [ $? -eq 0 ]
then
# assume we got an ip address
ip=$host
else
ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
if [ -z $ip ]
then
echo "Host '$host' unknown"
exit 1
fi
fi
shift
exec ssh $SSHCONF -q root@$ip $@