summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ModelIdResolver.java
diff options
context:
space:
mode:
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) {