Skip to content

Commit

Permalink
Dedupe bins in provisioner output (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
UnstoppableMango authored Aug 13, 2024
1 parent cf18ef4 commit 227ded8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions provider/pkg/operation/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ func DisplayAll(ops []*pb.Operation) string {
b := strings.Builder{}
b.WriteRune('[')

for _, o := range ops {
_, _ = b.WriteString(Display(o) + ", ")
d := make([]string, len(ops))
for i, o := range ops {
d[i] = Display(o)
}

b.WriteString(strings.Join(d, ", "))
b.WriteRune(']')
return b.String()
}
Expand Down
10 changes: 8 additions & 2 deletions provider/pkg/provisioner/command/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ func (s *service) Delete(ctx context.Context, req *pb.DeleteRequest) (*pb.Delete

log.InfoContext(ctx, "finished executing command", "cmd", cmd.String())
commands = append(commands, &pb.Operation{
Command: &pb.Command{Bin: pb.Bin_BIN_RM, Args: cmd.Args},
Command: &pb.Command{
Bin: pb.Bin_BIN_RM,
Args: cmd.Args[1:],
},
Result: &pb.Result{
ExitCode: int32(cmd.ProcessState.ExitCode()),
Stdout: stdout.String(),
Expand All @@ -201,7 +204,10 @@ func (s *service) Delete(ctx context.Context, req *pb.DeleteRequest) (*pb.Delete

log.InfoContext(ctx, "finished executing command", "cmd", cmd.String())
commands = append(commands, &pb.Operation{
Command: &pb.Command{Bin: pb.Bin_BIN_MV, Args: cmd.Args},
Command: &pb.Command{
Bin: pb.Bin_BIN_MV,
Args: cmd.Args[1:],
},
Result: &pb.Result{
ExitCode: int32(cmd.ProcessState.ExitCode()),
Stdout: stdout.String(),
Expand Down

0 comments on commit 227ded8

Please sign in to comment.