diff options
author | Harald Musum <musum@verizonmedia.com> | 2022-05-02 22:21:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-02 22:21:51 +0200 |
commit | a6dd1c95ebeb29db3efbda886c7b81840a4fe23e (patch) | |
tree | 313221e2c7eb9d2956e3bff4fff72978f1f677f9 | |
parent | e046ae79779261b09f85bcf4c04c906b83075775 (diff) | |
parent | dcae51ced05988d5030e8e7578cb75e70fdf7f05 (diff) |
Merge pull request #22387 from vespa-engine/hmusum/use-string-flag-for-files-with-unknown-extensionv7.581.33
Use a string flag for files with unknown extension in app
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java | 20 | ||||
-rw-r--r-- | flags/src/main/java/com/yahoo/vespa/flags/Flags.java | 7 |
2 files changed, 20 insertions, 7 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java index 3a54123f26e..ccfe8e31b69 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java @@ -43,15 +43,14 @@ import com.yahoo.vespa.config.server.zookeeper.SessionCounter; import com.yahoo.vespa.config.server.zookeeper.ZKApplication; import com.yahoo.vespa.curator.Curator; import com.yahoo.vespa.defaults.Defaults; -import com.yahoo.vespa.flags.BooleanFlag; import com.yahoo.vespa.flags.FlagSource; import com.yahoo.vespa.flags.Flags; +import com.yahoo.vespa.flags.StringFlag; import com.yahoo.yolean.Exceptions; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.recipes.cache.ChildData; import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent; import org.apache.zookeeper.KeeperException; - import java.io.File; import java.io.FilenameFilter; import java.io.IOException; @@ -129,7 +128,7 @@ public class SessionRepository { private final ModelFactoryRegistry modelFactoryRegistry; private final ConfigDefinitionRepo configDefinitionRepo; private final int maxNodeSize; - private final BooleanFlag failDeploymentForFilesWithUnknownExtension; + private final StringFlag failDeploymentForFilesWithUnknownExtension; public SessionRepository(TenantName tenantName, TenantApplications applicationRepo, @@ -173,7 +172,7 @@ public class SessionRepository { this.modelFactoryRegistry = modelFactoryRegistry; this.configDefinitionRepo = configDefinitionRepo; this.maxNodeSize = maxNodeSize; - this.failDeploymentForFilesWithUnknownExtension = Flags.FAIL_DEPLOYMENT_FOR_FILES_WITH_UNKNOWN_EXTENSION.bindTo(flagSource); + this.failDeploymentForFilesWithUnknownExtension = Flags.APPLICATION_FILES_WITH_UNKNOWN_EXTENSION.bindTo(flagSource); loadSessions(); // Needs to be done before creating cache below this.directoryCache = curator.createDirectoryCache(sessionsPath.getAbsolute(), false, false, zkCacheExecutor); @@ -686,9 +685,16 @@ public class SessionRepository { try { app.validateFileExtensions(); } catch (IllegalArgumentException e) { - if (failDeploymentForFilesWithUnknownExtension.value()) - throw e; - deployLogger.ifPresent(logger -> logger.logApplicationPackage(Level.WARNING, e.getMessage())); + switch (failDeploymentForFilesWithUnknownExtension.value()) { + case "FAIL": + throw e; + case "LOG": + deployLogger.ifPresent(logger -> logger.logApplicationPackage(Level.WARNING, e.getMessage())); + break; + case "NOOP": + default: + break; + } } return app; diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java index 572897c52ed..964893af6e0 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -397,6 +397,13 @@ public class Flags { "Takes effect at redeployment", ZONE_ID, APPLICATION_ID); + public static final UnboundStringFlag APPLICATION_FILES_WITH_UNKNOWN_EXTENSION = defineStringFlag( + "fail-deployment-for-files-with-unknown-extension", "NOOP", + List.of("hmusum"), "2022-04-27", "2022-05-27", + "Whether to log, fail or do nothing for deployments when app has a file with unknown extension (valid values LOG, FAIL, NOOP)", + "Takes effect at redeployment", + ZONE_ID, APPLICATION_ID); + public static final UnboundBooleanFlag NOTIFICATION_DISPATCH_FLAG = defineFeatureFlag( "dispatch-notifications", false, List.of("enygaard"), "2022-05-02", "2022-09-30", |