summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authortoby <smorgrav@yahoo-inc.com>2017-10-13 14:04:50 +0200
committertoby <smorgrav@yahoo-inc.com>2017-10-13 14:04:50 +0200
commita68cb0188c35601ffd14e34ea2c52e283c6eab60 (patch)
tree5429b1f7725c1cbe0f97f9285bfad1db0b5e60be /controller-server
parent75b888c31f0c751e3f6682bfd04efddeb7523913 (diff)
Simplify getting maintained deployments info
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java10
1 files changed, 3 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 1df0b1bca51..ac2d0373d9c 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
@@ -331,14 +331,10 @@ public class ApplicationController {
applicationPackage.zippedContent());
preparedApplication.activate();
- Deployment previousDeployment = application.deployments().get(zone);
- Deployment newDeployment = previousDeployment;
- if (previousDeployment == null) {
- newDeployment = new Deployment(zone, revision, version, clock.instant());
- } else {
- newDeployment = new Deployment(zone, revision, version, clock.instant(),
+ // Use info from previous deployments is available
+ Deployment previousDeployment = application.deployments().getOrDefault(zone, new Deployment(zone, revision, version, clock.instant()));
+ Deployment newDeployment = new Deployment(zone, revision, version, clock.instant(),
previousDeployment.clusterUtils(), previousDeployment.clusterInfo(), previousDeployment.metrics());
- }
application = application.with(newDeployment);
store(application, lock);