summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2023-04-30 14:44:51 +0200
committerGitHub <noreply@github.com>2023-04-30 14:44:51 +0200
commit8806fa5aca73fdf3cfe8bb8c8294827bdc8685ba (patch)
tree0d6a79775a43fd1065fb6b48f0d7bb92d9073230 /config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java
parent7edb75eeee6e14684d31ec23bcab342de6378605 (diff)
parent00b862bb9ae6f12ab9eb4f65f3c798f00922fecd (diff)
Merge pull request #26919 from vespa-engine/bratseth/ignore-pathv8.159.53
Ignore path on hosted when model-id is set
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java8
1 files changed, 6 insertions, 2 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) {