Skip to content

Commit 884f8c7

Browse files
committed
(fix): remove mistakenly added project label from key pairs list command
1 parent 2a3e7ee commit 884f8c7

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

internal/cmd/key-pair/list/list.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66
"strings"
77

8-
"github.com/stackitcloud/stackit-cli/internal/pkg/projectname"
98
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
109

1110
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
@@ -80,18 +79,12 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
8079

8180
items := resp.GetItems()
8281

83-
projectLabel, err := projectname.GetProjectName(ctx, params.Printer, params.CliVersion, cmd)
84-
if err != nil {
85-
params.Printer.Debug(print.ErrorLevel, "get project name: %v", err)
86-
projectLabel = model.ProjectId
87-
}
88-
8982
// Truncate output
9083
if model.Limit != nil && len(items) > int(*model.Limit) {
9184
items = items[:*model.Limit]
9285
}
9386

94-
return outputResult(params.Printer, model.OutputFormat, projectLabel, items)
87+
return outputResult(params.Printer, model.OutputFormat, items)
9588
},
9689
}
9790
configureFlags(cmd)
@@ -132,7 +125,7 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APICli
132125
return req
133126
}
134127

135-
func outputResult(p *print.Printer, outputFormat, projectLabel string, keyPairs []iaas.Keypair) error {
128+
func outputResult(p *print.Printer, outputFormat string, keyPairs []iaas.Keypair) error {
136129
return p.OutputResult(outputFormat, keyPairs, func() error {
137130
if len(keyPairs) == 0 {
138131
p.Outputf("No key pairs found\n")

internal/cmd/key-pair/list/list_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ func TestBuildRequest(t *testing.T) {
153153
func Test_outputResult(t *testing.T) {
154154
type args struct {
155155
outputFormat string
156-
projectLabel string
157156
keyPairs []iaas.Keypair
158157
}
159158
tests := []struct {
@@ -177,7 +176,7 @@ func Test_outputResult(t *testing.T) {
177176
t.Run(tt.name, func(t *testing.T) {
178177
params := testparams.NewTestParams()
179178

180-
if err := outputResult(params.Printer, tt.args.outputFormat, tt.args.projectLabel, tt.args.keyPairs); (err != nil) != tt.wantErr {
179+
if err := outputResult(params.Printer, tt.args.outputFormat, tt.args.keyPairs); (err != nil) != tt.wantErr {
181180
t.Errorf("outputResult() error = %v, wantErr %v", err, tt.wantErr)
182181
}
183182
})

0 commit comments

Comments
 (0)