]> git.nbdom.net Git - nb.git/commitdiff
bin/ovh-api
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 4 Feb 2017 21:38:01 +0000 (21:38 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 4 Feb 2017 21:38:01 +0000 (21:38 +0000)
bin/ovh-api

index 338e815d183e550331b340eb6f6b12250f2fdd86..e170c42ab7169ea21341382c999e7d446f913481 100755 (executable)
@@ -81,7 +81,6 @@ if (@ARGV and $ARGV[0] =~ /^(\w+):(\w+)(?::(\w+))?$/) {
 }
 
 @KEY or help();
-help() unless @ARGV;
 my $Api = OvhApi->new(type => OvhApi::OVH_API_EU, applicationKey => $KEY[0], applicationSecret => $KEY[1], consumerKey => $KEY[2]);
 
 # Auth
@@ -90,6 +89,7 @@ if (@KEY < 3) {
     method => 'ALL', path => '/*',
   }]);
 
+  die "Error" unless $Answer;
   if ($Answer) {
     my ($consumerKey, $validationUrl) = @{ $Answer->content}{qw{ consumerKey validationUrl }};
     push @KEY, $consumerKey;
@@ -104,6 +104,7 @@ if (@KEY < 3) {
 }
 
 # Query
+help() unless @ARGV;
 my $URL = shift @ARGV or help();
 my $BODY = @ARGV ? shift(@ARGV) : {};
 #use Data::Dumper; die Dumper(JSON::encode_json($BODY));