diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-01-05 21:29:35 +0100 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-01-05 21:29:35 +0100 |
commit | ecc56c918368f3c49239145b16041821e816f6fc (patch) | |
tree | 7b0296439c5a0df621c1b090ae9c1019c0d00047 /controller-api | |
parent | ae5a49d3449ffc174aadf334ccad7c1d3e5f851d (diff) |
Ignore zones for which there are no jobs in deployment step to job mapping
Diffstat (limited to 'controller-api')
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java index 5a4086f9abb..cee8d3ddfd9 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java @@ -79,18 +79,18 @@ public enum JobType { } /** Returns the job type for the given zone */ - public static JobType from(SystemName system, ZoneId zone) { + public static Optional<JobType> from(SystemName system, ZoneId zone) { for (JobType job : values()) if (zone.equals(job.zones.get(system))) - return job; - throw new IllegalArgumentException("No job is known for " + zone + "."); + return Optional.of(job); + return Optional.empty(); } /** Returns the job job type for the given environment and region or null if none */ - public static JobType from(SystemName system, Environment environment, RegionName region) { + public static Optional<JobType> from(SystemName system, Environment environment, RegionName region) { switch (environment) { - case test: return systemTest; - case staging: return stagingTest; + case test: return Optional.of(systemTest); + case staging: return Optional.of(stagingTest); } return from(system, ZoneId.from(environment, region)); } |