From: Devops Date: Mon, 3 Jul 2017 15:46:05 +0000 (+0100) Subject: Option ip-is-routed X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=8151b90acebb741209af15d8ee319f3ab553bae5;p=nb.git Option ip-is-routed --- diff --git a/bin/ovh-api b/bin/ovh-api index 7691e278..6100e8b4 100755 --- a/bin/ovh-api +++ b/bin/ovh-api @@ -59,9 +59,17 @@ ip_move($Opt{'ip-move'}) if $Opt{'ip-move'}; if ($Opt{'ip-routed'}) { my @routed = ip_routed($Opt{'ip-routed'}); print JSON::encode_json(\@routed); + require Sys::Hostname; + my $localhost = Sys::Hostname::hostname(); exit 0; } +if ($Opt{'ip-is-routed'}) { + my @routed = ip_routed($Opt{'ip-is-routed'}); + require Sys::Hostname; + my $localhost = Sys::Hostname::hostname(); + exit ! grep {$_ eq $localhost} @routed; +} # Query help() unless @ARGV; @@ -552,6 +560,7 @@ $NAME - Script to query ovh's api option[ip-move=s] Move IP to local option[ip-routed=s] Print where is routed an ip + option[ip-is-routed=s] Exit 0 if ip is routed to this host option[sql] Produce sql to update a database option[verbose|v+] Verbose mode: increase the verbosity level.