diff options
author | Håkon Hallingstad <hakon@yahooinc.com> | 2024-05-19 10:12:18 +0200 |
---|---|---|
committer | Håkon Hallingstad <hakon@yahooinc.com> | 2024-05-19 10:12:18 +0200 |
commit | 708081bd3c30c1f974bf25f025ec7f97ca4aaa26 (patch) | |
tree | 018a73b220e7e7a0cbffac7cc455b59909ca8133 /flags | |
parent | dec25d5ab61a9e574a8b41853caa879adfccf894 (diff) |
Make flags depend on config-provisioning
Diffstat (limited to 'flags')
-rw-r--r-- | flags/pom.xml | 5 | ||||
-rw-r--r-- | flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java | 14 |
2 files changed, 14 insertions, 5 deletions
diff --git a/flags/pom.xml b/flags/pom.xml index 9f3a9d35831..c86b753b38d 100644 --- a/flags/pom.xml +++ b/flags/pom.xml @@ -44,6 +44,11 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>com.yahoo.vespa</groupId> + <artifactId>config-provisioning</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <scope>provided</scope> diff --git a/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java b/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java index 66356d979a4..3f229862d7a 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java @@ -7,6 +7,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.yahoo.config.provision.ClusterSpec; +import com.yahoo.config.provision.SharedHosts; import com.yahoo.vespa.flags.PermanentFlags; import java.util.List; @@ -19,7 +21,7 @@ import java.util.Objects; */ @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(value = JsonInclude.Include.NON_NULL) -public class SharedHost { +public class SharedHost implements SharedHosts { private final List<HostResources> resources; @@ -43,14 +45,16 @@ public class SharedHost { /** Whether there are any shared hosts specifically for the given cluster type, or without a cluster type restriction. */ @JsonIgnore - public boolean supportsClusterType(String clusterType) { - return resources.stream().anyMatch(resource -> resource.clusterType().map(clusterType::equalsIgnoreCase).orElse(true)); + @Override + public boolean supportsClusterType(ClusterSpec.Type clusterType) { + return resources.stream().anyMatch(resource -> resource.clusterType().map(type -> clusterType.name().equalsIgnoreCase(type)).orElse(true)); } /** Whether there are any shared hosts specifically for the given cluster type. */ @JsonIgnore - public boolean hasClusterType(String clusterType) { - return resources.stream().anyMatch(resource -> resource.clusterType().map(clusterType::equalsIgnoreCase).orElse(false)); + @Override + public boolean hasClusterType(ClusterSpec.Type clusterType) { + return resources.stream().anyMatch(resource -> resource.clusterType().map(type -> clusterType.name().equalsIgnoreCase(type)).orElse(false)); } @JsonIgnore |