testing: ssh script accepts IP addresses instead of host names

This commit is contained in:
Tobias Brunner
2013-03-05 17:40:13 +01:00
parent 5057455674
commit 45ee7c9429
+7
View File
@@ -10,12 +10,19 @@ then
fi fi
host=$1 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 }'`" ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
if [ -z $ip ] if [ -z $ip ]
then then
echo "Host '$host' unknown" echo "Host '$host' unknown"
exit 1 exit 1
fi fi
fi
shift shift
exec ssh $SSHCONF -q root@$ip $@ exec ssh $SSHCONF -q root@$ip $@