Find logserver hostname through HostInfos, instead of VespaModel admin
@@ -705,25 +705,26 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
private String getLogServerHostname(ApplicationId applicationId) {
Application application = getApplication(applicationId);
- VespaModel model = (VespaModel) application.getModel();
- String logServerHostname = model.getAdmin().getLogserver().getHostName();
Collection<HostInfo> hostInfos = application.getModel().getHosts();
HostInfo logServerHostInfo = hostInfos.stream()
- .filter(host -> host.getHostname().equals(logServerHostname))
- .findFirst().orElseThrow(() -> new IllegalArgumentException("Could not find HostInfo"));
+ .filter(host -> host.getServices().stream()
+ .filter(serviceInfo ->
+ serviceInfo.getServiceType().equalsIgnoreCase("logserver"))
+ .count() > 0)
+ .findFirst().orElseThrow(() -> new IllegalArgumentException("Could not find HostInfo for LogServer"));
- ServiceInfo serviceInfo = logServerHostInfo.getServices().stream()
+ ServiceInfo containerServiceInfo = logServerHostInfo.getServices().stream()
.filter(service -> service.getServiceType().equals("container"))
.findFirst().orElseThrow(() -> new IllegalArgumentException("No container running on logserver host"));
- int port = serviceInfo.getPorts().stream()
+ int port = containerServiceInfo.getPorts().stream()
.filter(portInfo -> portInfo.getTags().stream()
.filter(tag -> tag.equalsIgnoreCase("http")).count() > 0)
.findFirst().orElseThrow(() -> new IllegalArgumentException("Could not find HTTP port"))
.getPort();
- return logServerHostname + ":" + port + "/logs";
+ return "http://" + logServerHostInfo.getHostname() + ":" + port + "/logs";
}
/** Returns version to use when deploying application in given environment */
