diff options
author | gjoranv <gv@verizonmedia.com> | 2020-07-17 22:57:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-17 22:57:26 +0200 |
commit | 4acc25ece51eee3de6eb89283c90f4c47e66323b (patch) | |
tree | 83593dbf12bfdba5fdc9abe70427e4b053257f2a | |
parent | 07a8078345c852b5b558a329afaee2c50ae843c3 (diff) | |
parent | c020e9a0ea5cb1f4130e6f12d510501bd33f7f40 (diff) |
Merge pull request #13922 from vespa-engine/gjoranv/simplify-bundle-installing
Gjoranv/simplify bundle installing
4 files changed, 16 insertions, 33 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java index 9cc83bb4275..0734c655e91 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java @@ -14,7 +14,9 @@ import com.yahoo.vespa.model.container.Container; import com.yahoo.vespa.model.container.component.AccessLogComponent; import com.yahoo.vespa.model.container.component.Component; import com.yahoo.vespa.model.container.component.Handler; +import com.yahoo.vespa.model.container.xml.PlatformBundles; +import java.nio.file.Path; import java.util.Set; import java.util.TreeSet; @@ -55,11 +57,12 @@ public class ClusterControllerContainer extends Container implements } addComponent(new AccessLogComponent(AccessLogComponent.AccessLogType.jsonAccessLog, "controller", isHosted)); - addFileBundle("lib/jars/clustercontroller-apps-jar-with-dependencies.jar"); - addFileBundle("lib/jars/clustercontroller-apputil-jar-with-dependencies.jar"); - addFileBundle("lib/jars/clustercontroller-core-jar-with-dependencies.jar"); - addFileBundle("lib/jars/clustercontroller-utils-jar-with-dependencies.jar"); - addFileBundle("lib/jars/zookeeper-server-jar-with-dependencies.jar"); + // TODO: Why are bundles added here instead of in the cluster? + addFileBundle("clustercontroller-apps"); + addFileBundle("clustercontroller-apputil"); + addFileBundle("clustercontroller-core"); + addFileBundle("clustercontroller-utils"); + addFileBundle("zookeeper-server"); } @Override @@ -82,8 +85,8 @@ public class ClusterControllerContainer extends Container implements super.addHandler(h); } - private void addFileBundle(String bundlePath) { - bundles.add("file:" + getDefaults().underVespaHome(bundlePath)); + private void addFileBundle(String bundleName) { + bundles.add(PlatformBundles.absoluteBundlePath(bundleName).toString()); } private ComponentModel createComponentModel(String id, String className, ComponentSpecification bundle) { diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java index e2d0868cb9d..f44abef607d 100755 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java @@ -69,8 +69,6 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; -import static com.yahoo.container.core.BundleLoaderProperties.DISK_BUNDLE_PREFIX; - /** * Parent class for all container cluster types. * @@ -474,14 +472,11 @@ public abstract class ContainerCluster<CONTAINER extends Container> @Override public void getConfig(PlatformBundlesConfig.Builder builder) { - platformBundles.stream() .map(ContainerCluster::toFileReferenceString) + platformBundles.stream() + .map(Path::toString) .forEach(builder::bundles); } - private static String toFileReferenceString(Path path) { - return DISK_BUNDLE_PREFIX + path.toString(); - } - @Override public void getConfig(QrSearchersConfig.Builder builder) { if (containerSearch != null) containerSearch.getConfig(builder); diff --git a/container-core/src/main/java/com/yahoo/container/core/BundleLoaderProperties.java b/container-core/src/main/java/com/yahoo/container/core/BundleLoaderProperties.java deleted file mode 100644 index ee12c7d4c9f..00000000000 --- a/container-core/src/main/java/com/yahoo/container/core/BundleLoaderProperties.java +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.container.core; - -/** - * @author gjoranv - */ -public interface BundleLoaderProperties { - - // TODO: This should be removed. The prefix is used to separate the bundles in BundlesConfig - // into those that are transferred with filedistribution and those that are preinstalled - // on disk. Instead, the model should have put them in two different configs. I.e. create a new - // config 'preinstalled-bundles.def'. - String DISK_BUNDLE_PREFIX = "file:"; - -} diff --git a/container-core/src/main/java/com/yahoo/container/core/config/DiskBundleInstaller.java b/container-core/src/main/java/com/yahoo/container/core/config/DiskBundleInstaller.java index 3edabe9f861..87c3d3048c5 100644 --- a/container-core/src/main/java/com/yahoo/container/core/config/DiskBundleInstaller.java +++ b/container-core/src/main/java/com/yahoo/container/core/config/DiskBundleInstaller.java @@ -8,8 +8,6 @@ import org.osgi.framework.Bundle; import java.io.File; import java.util.List; -import static com.yahoo.container.core.BundleLoaderProperties.DISK_BUNDLE_PREFIX; - /** * @author gjoranv */ @@ -17,8 +15,10 @@ public class DiskBundleInstaller implements BundleInstaller { @Override public List<Bundle> installBundles(FileReference reference, Osgi osgi) { - assert(reference.value().startsWith(DISK_BUNDLE_PREFIX)); - String referenceFileName = reference.value().substring(DISK_BUNDLE_PREFIX.length()); + // TODO: remove when the last model producing 'file:' has rolled out of hosted + String referenceFileName = reference.value().startsWith("file:") + ? reference.value().substring("file:".length()) + : reference.value(); File file = new File(referenceFileName); if ( ! file.exists()) { |