diff options
-rw-r--r-- | config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java b/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java index b50c38792c1..1e90f3974a5 100644 --- a/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java +++ b/config/src/main/java/com/yahoo/vespa/config/ConfigPayloadApplier.java @@ -231,29 +231,32 @@ public class ConfigPayloadApplier<T extends ConfigInstance.Builder> { return getValueFromInspector(value); } + /** + * This may run on both the config server and subscribing nodes. + * We only have a urlDownloader set up when client side. + */ + private boolean isClientside() { + return urlDownloader != null; + } + private FileReference resolvePath(String value) { Path path = pathAcquirer.getPath(new FileReference(value)); return new FileReference(path.toString()); } private UrlReference resolveUrl(String url) { - if (! canResolveUrls()) // assuming config server - keep the url - return new UrlReference(url); + if ( ! isClientside()) return new UrlReference(url); File file = urlDownloader.waitFor(new UrlReference(url), 60 * 60); return new UrlReference(file.getAbsolutePath()); } - private boolean canResolveUrls() { - return urlDownloader != null; - } - private ModelReference resolveModel(String modelStringValue) { var model = ModelReference.valueOf(modelStringValue); if (model.isResolved()) return model; - if (model.url().isPresent() && canResolveUrls()) // url has priority + if (isClientside() && model.url().isPresent()) // url has priority return ModelReference.resolved(Path.of(resolveUrl(model.url().get().value()).value())); - if (model.path().isPresent()) + if (isClientside() && model.path().isPresent()) return ModelReference.resolved(Path.of(resolvePath(model.path().get().value()).value())); return model; } |