strip one proto layer in ListMachines method

This commit is contained in:
Pavel Sviderski
2024-12-03 11:05:58 +10:00
parent daada3bbe9
commit 77890b8a8a
6 changed files with 28 additions and 17 deletions
+3 -3
View File
@@ -225,12 +225,12 @@ func (cli *CLI) AddMachine(ctx context.Context, remoteMachine RemoteMachine, clu
}
// List other machines in the cluster to include them in the join request.
listResp, err := c.ListMachines(ctx, &emptypb.Empty{})
machines, err := c.ListMachines(ctx)
if err != nil {
return fmt.Errorf("list cluster machines: %w", err)
}
otherMachines := make([]*pb.MachineInfo, 0, len(listResp.Machines)-1)
for _, m := range listResp.Machines {
otherMachines := make([]*pb.MachineInfo, 0, len(machines)-1)
for _, m := range machines {
if m.Machine.Id != addResp.Machine.Id {
otherMachines = append(otherMachines, m.Machine)
}