diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-02-02 10:14:03 +0100 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2018-02-02 10:14:03 +0100 |
commit | aa5459f34d7d19a48fe1e096c11df9aca729f3d0 (patch) | |
tree | 04f43c5d69731e91cb5583baa8cc46de7db8174b /controller-server | |
parent | 14e3b8915d5551216389a1c22c680c13a15b8fe5 (diff) |
Create application in Athenz only for defaults
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java index cfc9a2e6db2..f368a17bd10 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java @@ -236,7 +236,7 @@ public class ApplicationController { * @throws IllegalArgumentException if the application already exists */ public Application createApplication(ApplicationId id, Optional<NToken> token) { - if ( ! (id.instance().value().equals("default") || id.instance().value().matches("\\d+"))) // TODO: Support instances properly + if ( ! (id.instance().isDefault() || id.instance().value().matches("\\d+"))) // TODO: Support instances properly throw new UnsupportedOperationException("Only the instance names 'default' and names which are just the PR number are supported at the moment"); try (Lock lock = lock(id)) { // Validate only application names which do not already exist. @@ -250,16 +250,11 @@ public class ApplicationController { throw new IllegalArgumentException("Could not create '" + id + "': Application already exists"); if (get(dashToUnderscore(id)).isPresent()) // VESPA-1945 throw new IllegalArgumentException("Could not create '" + id + "': Application " + dashToUnderscore(id) + " already exists"); - if (tenant.get().isAthensTenant()) { + if (id.instance().isDefault() && tenant.get().isAthensTenant()) { // Only create the athens application for "default" instances. if ( ! token.isPresent()) throw new IllegalArgumentException("Could not create '" + id + "': No NToken provided"); ZmsClient zmsClient = zmsClientFactory.createZmsClientWithAuthorizedServiceToken(token.get()); - try { - zmsClient.deleteApplication(tenant.get().getAthensDomain().get(), - new com.yahoo.vespa.hosted.controller.api.identifiers.ApplicationId(id.application().value())); - } - catch (ZmsException ignored) { } zmsClient.addApplication(tenant.get().getAthensDomain().get(), new com.yahoo.vespa.hosted.controller.api.identifiers.ApplicationId(id.application().value())); } |