Skip to content
This repository has been archived by the owner on Sep 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1181 from spotify/dxia/patch1
Browse files Browse the repository at this point in the history
Fix NPEs
  • Loading branch information
davidxia committed Nov 7, 2017
2 parents f91ed43 + 704dfd5 commit 2058cb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import static com.spotify.helios.servicescommon.coordination.ZooKeeperOperations.create;
import static com.spotify.helios.servicescommon.coordination.ZooKeeperOperations.delete;
import static com.spotify.helios.servicescommon.coordination.ZooKeeperOperations.set;
import static java.lang.Boolean.TRUE;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.Collections.singletonList;
Expand Down Expand Up @@ -958,7 +959,10 @@ private RollingUpdateOp rollingUpdateAwaitRunning(final ZooKeeperClient client,
private boolean isRolloutTimedOut(final ZooKeeperClient client,
final DeploymentGroup deploymentGroup) {
final String groupName = deploymentGroup.getName();
final long groupTimeoutSetting = deploymentGroup.getRolloutOptions().getTimeout();
final long groupTimeoutSetting = deploymentGroup.getRolloutOptions() != null
&& deploymentGroup.getRolloutOptions().getTimeout() != null
? deploymentGroup.getRolloutOptions().getTimeout()
: RolloutOptions.getDefault().getTimeout();
final long secondsSinceDeploy;
try {
final String statusPath = Paths.statusDeploymentGroupTasks(groupName);
Expand Down Expand Up @@ -1131,7 +1135,8 @@ private boolean ownedByDeploymentGroup(final Deployment deployment,
}

private boolean isMigration(final Deployment deployment, final DeploymentGroup deploymentGroup) {
return (deploymentGroup.getRolloutOptions().getMigrate()
return (deploymentGroup.getRolloutOptions() != null
&& TRUE.equals(deploymentGroup.getRolloutOptions().getMigrate())
&& deployment.getJobId().equals(deploymentGroup.getJobId()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static com.spotify.helios.servicescommon.coordination.ZooKeeperOperations.create;
import static com.spotify.helios.servicescommon.coordination.ZooKeeperOperations.delete;
import static com.spotify.helios.servicescommon.coordination.ZooKeeperOperations.set;
import static java.lang.Boolean.TRUE;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -160,7 +161,7 @@ public RollingUpdateOp yield() {

private boolean isIgnoreFailures() {
return deploymentGroup.getRolloutOptions() != null
&& deploymentGroup.getRolloutOptions().getIgnoreFailures();
&& TRUE.equals(deploymentGroup.getRolloutOptions().getIgnoreFailures());
}

public RollingUpdateOp error(final String msg, final String host,
Expand Down

0 comments on commit 2058cb4

Please sign in to comment.