From 00b862bb9ae6f12ab9eb4f65f3c798f00922fecd Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Sun, 30 Apr 2023 14:44:06 +0200 Subject: Ignore path on hosted when model-id is set --- .../java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java | 8 ++++++-- .../com/yahoo/vespa/model/container/xml/EmbedderTestCase.java | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java index 0e52e56d653..ff261d2b83a 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java @@ -51,11 +51,15 @@ public class ModelIdResolver { /** Expands a model config value into regular config values. */ private static void transformModelValue(Element value, boolean hosted) { if ( ! value.hasAttribute("model-id")) return; - if (hosted) + + if (hosted) { value.setAttribute("url", modelIdToUrl(value.getTagName(), value.getAttribute("model-id"))); - else if ( ! value.hasAttribute("url") && ! value.hasAttribute("path")) + value.removeAttribute("path"); + } + else if ( ! value.hasAttribute("url") && ! value.hasAttribute("path")) { throw new IllegalArgumentException(value.getTagName() + " is configured with only a 'model-id'. " + "Add a 'path' or 'url' to deploy this outside Vespa Cloud"); + } } private static String modelIdToUrl(String valueName, String modelId) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/EmbedderTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/EmbedderTestCase.java index ba22e1c6350..50416d50fe5 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/EmbedderTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/EmbedderTestCase.java @@ -55,7 +55,7 @@ public class EmbedderTestCase { String input = "" + " " + " " + - " " + + " " + " " + ""; String component = "" + -- cgit v1.2.3