aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Juul <arnej@yahoo-inc.com>2018-05-18 08:59:22 +0000
committerArne Juul <arnej@yahoo-inc.com>2018-05-18 12:08:59 +0000
commit6ad2c1b0f14972aa6df8082e96385b032be182f4 (patch)
tree959c0e4ac40a6ff46cc03604a1a3aea703d9f5d3
parentb857943bb81747a24c8b9461e7337ddba614b698 (diff)
move perl complexity to simpler shell function
-rwxr-xr-xconfig/src/apps/vespa-config/vespa-config.pl24
-rwxr-xr-xconfigserver/src/main/sh/start-configserver17
2 files changed, 14 insertions, 27 deletions
diff --git a/config/src/apps/vespa-config/vespa-config.pl b/config/src/apps/vespa-config/vespa-config.pl
index 7f631187b58..6c0eb241959 100755
--- a/config/src/apps/vespa-config/vespa-config.pl
+++ b/config/src/apps/vespa-config/vespa-config.pl
@@ -266,24 +266,6 @@ sub printConfigHttpSources {
print $out . "\n";
}
-sub isThisAConfigServer {
- my $addr;
- foreach $addr (getConfigServers()) {
- my $host = "";
- my $port = 0;
- if ($addr =~ /(.*):(\d+)$/) {
- $host = $1;
- }
- if ($myHostname eq $host or $host eq "localhost") {
- print "yes\n";
- exit 0;
- }
- }
-
- print "no\n";
- exit 1;
-}
-
# Perl trim function to remove whitespace from the start and end of the string
sub trim($) {
my $string = shift;
@@ -299,7 +281,7 @@ sub getLastLine {
sub usage {
print "usage: ";
- print "vespa-config [-configsources | -confighttpsources | -zkstring | -configserverport | -zkclientport | -isthisaconfigserver]\n";
+ print "vespa-config [-configsources | -confighttpsources | -zkstring | -configserverport | -zkclientport]\n";
}
if ( @ARGV == 0 ) {
@@ -334,10 +316,6 @@ if ( $ARGV[0] eq "-zkclientport" ) {
print "$zk_client_port\n";
exit 0;
}
-if ( $ARGV[0] eq "-isthisaconfigserver" ) {
- isThisAConfigServer();
- exit 0;
-}
usage();
exit 1;
diff --git a/configserver/src/main/sh/start-configserver b/configserver/src/main/sh/start-configserver
index f476fbb89a0..03ce136e13c 100755
--- a/configserver/src/main/sh/start-configserver
+++ b/configserver/src/main/sh/start-configserver
@@ -98,10 +98,19 @@ fixddir ${VESPA_HOME}/var/zookeeper
fixfile ${VESPA_HOME}/var/zookeeper/myid
fixddir ${VESPA_HOME}/var/zookeeper/version-2
-${VESPA_HOME}/libexec/vespa/vespa-config.pl -isthisaconfigserver 1>/dev/null
-if [ "$?" != "0" ] ; then
- echo "Not able to start config server, host `hostname` is not part of 'VESPA_CONFIGSERVERS'"
- exit 1;
+not_a_configserver () {
+ for hn in $(vespa-print-default configservers); do
+ if [ "$hn" = localhost ] || [ "$hn" = "${VESPA_HOSTNAME}" ]; then
+ return 1
+ fi
+ done
+ return 0
+}
+
+if not_a_configserver ; then
+ echo "Will not start config server, host ${VESPA_HOSTNAME}" \
+ "is not part of VESPA_CONFIGSERVERS: " $(vespa-print-default configservers)
+ exit 1
fi
fixlimits