From 8151b90acebb741209af15d8ee319f3ab553bae5 Mon Sep 17 00:00:00 2001 From: Devops Date: Mon, 3 Jul 2017 16:46:05 +0100 Subject: [PATCH] Option ip-is-routed --- bin/ovh-api | 9 +++++++++ 1 file changed, 9 insertions(+) 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. -- 2.47.3