.setError(errMsg) .build();
.setError("Stopped by user") .build(); final String statusPath = Paths.statusDeploymentGroup(deploymentGroupName);
@Override public void stopDeploymentGroup(final String deploymentGroupName) throws DeploymentGroupDoesNotExistException { checkNotNull(deploymentGroupName, "name"); log.info("stop deployment-group: name={}", deploymentGroupName); final ZooKeeperClient client = provider.get("stopDeploymentGroup"); final DeploymentGroup deploymentGroup = getDeploymentGroup(deploymentGroupName); final String statusPath = Paths.statusDeploymentGroup(deploymentGroupName); final DeploymentGroupStatus status = DeploymentGroupStatus.newBuilder() .setDeploymentGroup(deploymentGroup) .setState(FAILED) .setError("Stopped by user") .build(); try { client.ensurePath(statusPath); client.transaction(set(statusPath, status)); } catch (final NoNodeException e) { throw new DeploymentGroupDoesNotExistException(deploymentGroupName); } catch (final KeeperException e) { throw new HeliosRuntimeException( "stop deployment-group " + deploymentGroupName + " failed", e); } }
opsEvents.addOperation(set(statusPath, status.toBuilder() .setState(FAILED) .setError(errMsg) .build())); } else {
public Builder toBuilder() { return newBuilder() .setState(state) .setError(error); }