aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-09-29 23:09:19 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-09-29 23:09:19 +0200
commit5e9a24a520d0eb9ffe955944f59c02dddf405c3f (patch)
treecc70bdd6a0ad318770f131b159a6d11c2d4777cd
parentf3b9d612c2fc4229df0ea1c8039537b2e5d519f7 (diff)
Minor fixes
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/provision/SingleNodeProvisioner.java9
-rwxr-xr-xconfig-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/utils/FileSender.java11
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java4
-rw-r--r--vespajlib/src/main/java/com/yahoo/net/HostName.java7
5 files changed, 16 insertions, 16 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/provision/SingleNodeProvisioner.java b/config-model/src/main/java/com/yahoo/config/model/provision/SingleNodeProvisioner.java
index 87dff27611e..fe8b3935fcf 100644
--- a/config-model/src/main/java/com/yahoo/config/model/provision/SingleNodeProvisioner.java
+++ b/config-model/src/main/java/com/yahoo/config/model/provision/SingleNodeProvisioner.java
@@ -25,8 +25,13 @@ public class SingleNodeProvisioner implements HostProvisioner {
private int counter = 0;
public SingleNodeProvisioner() {
- host = new Host(HostName.getLocalhost());
- this.hostSpec = new HostSpec(host.hostname(), host.aliases());
+ try {
+ host = new Host(HostSystem.lookupCanonicalHostname(HostName.getLocalhost()));
+ this.hostSpec = new HostSpec(host.hostname(), host.aliases());
+ }
+ catch (UnknownHostException e) {
+ throw new RuntimeException(e);
+ }
}
@Override
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
index 743875b1ea5..485e206f9a3 100755
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
@@ -328,7 +328,6 @@ public final class ContainerCluster
private void addAndSendApplicationBundles() {
for (ComponentInfo component : getRoot().getDeployState().getApplicationPackage().getComponentsInfo(getRoot().getDeployState().getProperties().vespaVersion())) {
FileReference reference = FileSender.sendFileToServices(component.getPathRelativeToAppDir(), containers);
- System.out.println("Adding app bundle " + component + ", reference " + reference);
applicationBundles.add(reference);
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/utils/FileSender.java b/config-model/src/main/java/com/yahoo/vespa/model/utils/FileSender.java
index 147e5f1bfa5..84685ecef3d 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/utils/FileSender.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/utils/FileSender.java
@@ -32,8 +32,8 @@ public class FileSender implements Serializable {
public static FileReference sendFileToServices(String relativePath,
Collection<? extends AbstractService> services) {
if (services.isEmpty()) {
- throw new IllegalStateException("'sendFileToServices called for empty services!" +
- " - This should never happen!");
+ throw new IllegalStateException("No service instances. Probably a standalone cluster setting up <nodes> " +
+ "using 'count' instead of <node> tags.");
}
FileReference fileref = null;
for (AbstractService service : services) {
@@ -142,10 +142,9 @@ public class FileSender implements Serializable {
FileReference reference = sentFiles.get(path);
if (reference == null) {
reference = sendFileToServices(path, services);
- if (reference != null) // null when standalone TODO: Create admin in StandaloneContainerApplication instead
- sentFiles.put(path, reference);
+ sentFiles.put(path, reference);
}
- if (reference != null) // null when standalone TODO: Create admin in StandaloneContainerApplication instead
- builder.setValue(reference.value());
+ builder.setValue(reference.value());
}
+
} \ No newline at end of file
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java
index bcefcb3c67d..87fb5e567a5 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java
@@ -102,7 +102,7 @@ public class VespaModelTestCase {
LogdConfig.Builder b = new LogdConfig.Builder();
b = (LogdConfig.Builder) model.getConfig(b, "");
LogdConfig c = new LogdConfig(b);
- assertEquals(HostName.getLocalhost(), c.logserver().host());
+ assertEquals(HostSystem.lookupCanonicalHostname(HostName.getLocalhost()), c.logserver().host());
SlobroksConfig.Builder sb = new SlobroksConfig.Builder();
sb = (com.yahoo.cloud.config.SlobroksConfig.Builder) model.getConfig(sb, "");
@@ -113,7 +113,7 @@ public class VespaModelTestCase {
zb = (ZookeepersConfig.Builder) model.getConfig(zb, "");
ZookeepersConfig zc = new ZookeepersConfig(zb);
assertEquals(zc.zookeeperserverlist().split(",").length, 2);
- assertTrue(zc.zookeeperserverlist().startsWith(HostName.getLocalhost()));
+ assertTrue(zc.zookeeperserverlist().startsWith(HostSystem.lookupCanonicalHostname(HostName.getLocalhost())));
ApplicationIdConfig.Builder appIdBuilder = new ApplicationIdConfig.Builder();
appIdBuilder = (ApplicationIdConfig.Builder) model.getConfig(appIdBuilder, "");
diff --git a/vespajlib/src/main/java/com/yahoo/net/HostName.java b/vespajlib/src/main/java/com/yahoo/net/HostName.java
index 7d5617f41e5..4e791ca117a 100644
--- a/vespajlib/src/main/java/com/yahoo/net/HostName.java
+++ b/vespajlib/src/main/java/com/yahoo/net/HostName.java
@@ -15,15 +15,12 @@ public class HostName {
private static String myHost = null;
/**
- * Static method that returns the name of localhost using shell
- * command "hostname".
+ * Static method that returns the name of localhost using shell command "hostname".
+ * If you need a guaranteed resolvable name see LinuxINetAddress.
*
* @return the name of localhost.
* @throws RuntimeException if executing the command 'hostname' fails.
*/
- // Note. This will not currently return a FQDN in Mac.
- // If that is needed, add
- // java.net.InetAddress.getByName(myHost).getCanonicalHostName()
public static synchronized String getLocalhost() {
if (myHost == null) {
try {