Add IP validation
Prevent user from direct copy/paste
This commit is contained in:
parent
2163f1cfaa
commit
9a0a012743
@ -27,3 +27,13 @@ get_container_ip() {
|
||||
fi
|
||||
echo $ip
|
||||
}
|
||||
|
||||
validate_ip() {
|
||||
ip=$1
|
||||
rx='([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'
|
||||
if [[ $ip =~ ^$rx\.$rx\.$rx\.$rx$ ]]; then
|
||||
return 0
|
||||
fi
|
||||
echo Invalid ip address ${ip}
|
||||
return 1
|
||||
}
|
||||
|
@ -38,6 +38,9 @@ if [ "$etcd_ip" == "" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# will error out if fail since we have set -e
|
||||
validate_ip ${etcd_ip}
|
||||
|
||||
network_option=
|
||||
if [ "$network" != "" ]; then
|
||||
network_option="--network ${network}"
|
||||
|
Loading…
Reference in New Issue
Block a user