diff options
author | Arne Juul <arnej@yahoo-inc.com> | 2018-07-03 12:55:34 +0200 |
---|---|---|
committer | Arne Juul <arnej@yahoo-inc.com> | 2018-07-03 13:35:07 +0200 |
commit | 8dbdc0271db7f53b935df5ebe620f10719dbab1d (patch) | |
tree | 0572efbdb98b40b256d137c74923102f27966444 /vespaclient | |
parent | 610112d4be0016793c9bd3b79e73625e018afcff (diff) |
loop over all config servers
* This reverts commit 0800d9b7d9540fa83fb85d99e87c2d5971236fae.
* second try, actually runs the correct command
Diffstat (limited to 'vespaclient')
-rw-r--r-- | vespaclient/src/perl/lib/Yahoo/Vespa/VespaModel.pm | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/vespaclient/src/perl/lib/Yahoo/Vespa/VespaModel.pm b/vespaclient/src/perl/lib/Yahoo/Vespa/VespaModel.pm index b1675130ec4..fd324540bba 100644 --- a/vespaclient/src/perl/lib/Yahoo/Vespa/VespaModel.pm +++ b/vespaclient/src/perl/lib/Yahoo/Vespa/VespaModel.pm @@ -170,10 +170,9 @@ sub retrieveModelConfigDefault { # () 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`; @@ -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 = `$hostcmd 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(); |