summaryrefslogtreecommitdiffstats
path: root/vespaclient/src/perl/bin/GetClusterState.pl
diff options
context:
space:
mode:
Diffstat (limited to 'vespaclient/src/perl/bin/GetClusterState.pl')
-rwxr-xr-xvespaclient/src/perl/bin/GetClusterState.pl11
1 files changed, 7 insertions, 4 deletions
diff --git a/vespaclient/src/perl/bin/GetClusterState.pl b/vespaclient/src/perl/bin/GetClusterState.pl
index 155db87f34e..aee988c74ff 100755
--- a/vespaclient/src/perl/bin/GetClusterState.pl
+++ b/vespaclient/src/perl/bin/GetClusterState.pl
@@ -53,14 +53,17 @@ sub findhome {
}
sub findhost {
- $ENV{'PATH'} = $ENV{'VESPA_HOME'} . '/bin:' . $ENV{'PATH'};
my $tmp = $ENV{'VESPA_HOSTNAME'};
+ my $bin = $ENV{'VESPA_HOME'} . "/bin";
if (!defined $tmp) {
- $tmp = `vespa-detect-hostname` or die "Could not detect hostname\n";
+ $tmp = `${bin}/vespa-detect-hostname || hostname -f || hostname || echo "localhost"`;
chomp $tmp;
}
- system("vespa-validate-hostname $tmp");
- ( $? == 0 ) or die "Could not validate hostname\n";
+ my $validate = "${bin}/vespa-validate-hostname";
+ if (-f "${validate}") {
+ system("${validate} $tmp");
+ ( $? == 0 ) or die "Could not validate hostname\n";
+ }
return $tmp;
}