diff options
author | Arne Juul <arnej@yahoo-inc.com> | 2018-06-26 07:17:54 +0200 |
---|---|---|
committer | Arne Juul <arnej@yahoo-inc.com> | 2018-06-26 07:17:54 +0200 |
commit | eaf19a42909f6375a20fe4a6bba6d03eb94d31d8 (patch) | |
tree | 7f1aa9b8dc442a41764fb6ee386606e5440d1f00 /vespaclient | |
parent | 49a532f515d9ce217def27443b5bb9faa6410124 (diff) |
loop over all config servers
Diffstat (limited to 'vespaclient')
-rw-r--r-- | vespaclient/src/perl/lib/Yahoo/Vespa/VespaModel.pm | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/vespaclient/src/perl/lib/Yahoo/Vespa/VespaModel.pm b/vespaclient/src/perl/lib/Yahoo/Vespa/VespaModel.pm index b1675130ec4..fc5c360ff4c 100644 --- a/vespaclient/src/perl/lib/Yahoo/Vespa/VespaModel.pm +++ b/vespaclient/src/perl/lib/Yahoo/Vespa/VespaModel.pm @@ -166,15 +166,14 @@ sub retrieveModelConfigDefault { # () if (defined $CONFIG_REQUEST_TIMEOUT) { $cmd .= " -w $CONFIG_REQUEST_TIMEOUT"; + } else { + $cmd .= " -w 2"; } - if (!defined $CONFIG_SERVER_HOST) { my $temp = `${VESPA_HOME}/bin/vespa-print-default configservers`; - my @configServerHosts = split(' ', $temp); - $CONFIG_SERVER_HOST = $configServerHosts[0]; + chomp($temp); + $CONFIG_SERVER_HOST = $temp; } - $cmd .= " -s $CONFIG_SERVER_HOST"; - if (!defined $CONFIG_SERVER_PORT) { my $temp = `${VESPA_HOME}/bin/vespa-print-default configserver_rpc_port`; chomp($temp); @@ -182,16 +181,23 @@ sub retrieveModelConfigDefault { # () } $cmd .= " -p $CONFIG_SERVER_PORT"; - printDebug "Fetching model config '$cmd'.\n"; - my @data = `$cmd 2>&1`; - if ($? != 0 || join(' ', @data) =~ /^error/) { - printError "Failed to get model config from config command line tool:\n" - . "Command: $cmd\n" + my $errors = ""; + foreach my $cfshost (split(' ', $CONFIG_SERVER_HOST)) { + my $hostcmd = $cmd . " -s $cfshost"; + + printDebug "Fetching model config '$hostcmd'.\n"; + my @data = `$cmd 2>&1`; + if ($? != 0 || join(' ', @data) =~ /^error/) { + $errors .= "Failed to get model config from config command line tool:\n" + . "Command: $hostcmd\n" . "Exit code: $?\n" . "Output: " . join("\n", @data) . "\n"; - exitApplication(1); + } else { + return @data; + } } - return @data; + printError $errors; + exitApplication(1); } sub fetch { # () my @data = &$RETRIEVE_MODEL_CONFIG(); |