Skip to content

Commit

Permalink
minor refactor in CE import
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeSeqLabs committed Sep 25, 2023
1 parent 58dd657 commit 4a43bc8
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@
import io.seqera.tower.cli.commands.computeenvs.add.AbstractAddCmd;
import io.seqera.tower.cli.commands.computeenvs.platforms.Platform;
import io.seqera.tower.cli.exceptions.ComputeEnvNotFoundException;
import io.seqera.tower.cli.exceptions.PipelineNotFoundException;
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.utils.FilesHelper;
import io.seqera.tower.model.ComputeConfig;
import io.seqera.tower.model.ComputeEnv;
import io.seqera.tower.model.ComputeEnvDbDto;
import io.seqera.tower.model.ComputeEnvResponseDto;
import io.seqera.tower.model.PipelineDbDto;
import picocli.CommandLine;

import java.io.IOException;
Expand All @@ -49,7 +46,7 @@ protected Response exec() throws ApiException, IOException {

Long wspId = workspaceId(workspace.workspace);

if (overwrite) deleteCE(name, wspId);
if (overwrite) tryDeleteCE(name, wspId);

return addComputeEnv(platform, configObj);
}
Expand All @@ -59,7 +56,7 @@ protected Platform getPlatform() {
throw new UnsupportedOperationException("Unknown platform");
}

private void deleteCE(String name, Long wspId) throws ApiException {
private void tryDeleteCE(String name, Long wspId) throws ApiException {
try {
ComputeEnvResponseDto ce = computeEnvByRef(wspId, name);
api().deleteComputeEnv(ce.getId(), wspId);
Expand Down

0 comments on commit 4a43bc8

Please sign in to comment.