summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorArne Juul <arnej@yahoo-inc.com>2017-09-08 07:52:01 +0000
committerArne Juul <arnej@yahoo-inc.com>2017-09-08 07:52:01 +0000
commit5734bcd664f92dd29f40d3cb8fad85547e6c9fef (patch)
tree65a6ebc8918d42cfa4005b8db0358dc663fb23a9 /config
parent692c6ee908c0253445fd3191c85f58e427566873 (diff)
use Defaults::vespaHostname
Diffstat (limited to 'config')
-rwxr-xr-xconfig/src/apps/vespa-config/vespa-config.pl19
1 files changed, 6 insertions, 13 deletions
diff --git a/config/src/apps/vespa-config/vespa-config.pl b/config/src/apps/vespa-config/vespa-config.pl
index cc0daed3e7d..d54d7af4418 100755
--- a/config/src/apps/vespa-config/vespa-config.pl
+++ b/config/src/apps/vespa-config/vespa-config.pl
@@ -72,6 +72,8 @@ use warnings;
use File::Copy;
use File::Temp;
+my $myHostname = `vespa-print-default hostname`;
+chomp $myHostname;
my $default_configproxy_port = "19090";
my $default_configserver_port = "19070";
my $zk_client_port;
@@ -155,10 +157,7 @@ sub printConfigServerPort {
sub getConfigServers {
my @ret;
- my $hostname = `hostname`;
- chomp $hostname;
-
- my $addr = getVar('addr_configserver', $hostname, 1);
+ my $addr = getVar('addr_configserver', $myHostname, 1);
my $port = getVar('port_configserver_rpc', $default_configserver_port, 0);
my $h;
@@ -253,9 +252,7 @@ sub makeFiledistributorDistributorConfig {
my $cfgFile = $VESPA_HOME . "/conf/filedistributor/filedistributor.cfg";
open(CFG, "> ${cfgFile}.new") or die "Cannot write to '${cfgFile}.new'";
print CFG "torrentport 19093\n";
- my $hostname = `hostname`;
- chomp $hostname;
- print CFG "hostname \"$hostname\"\n";
+ print CFG "hostname \"$myHostname\"\n";
print CFG "filedbpath \"$VESPA_HOME" . "/var/db/vespa/filedistribution\"\n";
print CFG "maxdownloadspeed 0\n";
print CFG "maxuploadspeed 0\n";
@@ -268,9 +265,7 @@ sub makeFiledistributorDistributorConfig {
sub makeFiledistributorRpcConfig {
my $cfgFile = $VESPA_HOME . "/conf/filedistributor/filedistributorrpc.cfg";
open(CFG, "> ${cfgFile}.new") or die "Cannot write to '${cfgFile}.new'";
- my $hostname = `hostname`;
- chomp $hostname;
- print CFG "connectionspec \"tcp/$hostname:19092\"\n";
+ print CFG "connectionspec \"tcp/$myHostname:19092\"\n";
close(CFG);
rename("${cfgFile}.new", ${cfgFile})
or die "Cannot rename '${cfgFile}.new' -> '${cfgFile}': $!\n";
@@ -294,8 +289,6 @@ sub makeFiledistributorConfig {
}
sub isThisAConfigServer {
- my $hostnameForThisHost = `hostname`;
- chomp $hostnameForThisHost;
my $addr;
foreach $addr (getConfigServers()) {
my $host = "";
@@ -303,7 +296,7 @@ sub isThisAConfigServer {
if ($addr =~ /(.*):(\d+)$/) {
$host = $1;
}
- if ($hostnameForThisHost eq $host or $host eq "localhost") {
+ if ($myHostname eq $host or $host eq "localhost") {
print "yes\n";
exit 0;
}