Skip to content

Commit

Permalink
fix(cli): namespace update should not try to unserialize tasks
Browse files Browse the repository at this point in the history
plugin can be not present on the server that emit the command
  • Loading branch information
tchiotludo committed Mar 22, 2023
1 parent 809e0ea commit 900d38c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.kestra.cli.commands;

import io.kestra.cli.AbstractApiCommand;
import lombok.*;
import lombok.extern.jackson.Jacksonized;
import picocli.CommandLine;

import java.nio.file.Path;
Expand All @@ -14,4 +16,12 @@ public abstract class AbstractServiceNamespaceUpdateCommand extends AbstractApiC

@CommandLine.Option(names = {"--no-delete"}, description = "if missing should not be deleted")
public boolean noDelete = false ;

@Builder
@Value
@Jacksonized
public static class UpdateResult {
String id;
String namespace;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public Integer call() throws Exception {
MutableHttpRequest<String> request = HttpRequest
.POST("/api/v1/flows/" + namespace + "?delete=" + !noDelete, body).contentType(MediaType.APPLICATION_YAML);

List<FlowWithSource> updated = client.toBlocking().retrieve(
List<UpdateResult> updated = client.toBlocking().retrieve(
this.requestOptions(request),
Argument.listOf(FlowWithSource.class)
Argument.listOf(UpdateResult.class)
);

stdOut(updated.size() + " flow(s) for namespace '" + namespace + "' successfully updated !");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public Integer call() throws Exception {
MutableHttpRequest<List<Template>> request = HttpRequest
.POST("/api/v1/templates/" + namespace + "?delete=" + !noDelete, templates);

List<Template> updated = client.toBlocking().retrieve(
List<UpdateResult> updated = client.toBlocking().retrieve(
this.requestOptions(request),
Argument.listOf(Template.class)
Argument.listOf(UpdateResult.class)
);

stdOut(updated.size() + " template(s) for namespace '" + namespace + "' successfully updated !");
Expand Down

0 comments on commit 900d38c

Please sign in to comment.