Skip to content

Commit ee1b411

Browse files
committed
adapted server volumes list command to align to expectations
1 parent 4083b93 commit ee1b411

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • internal/cmd/server/volume/list

internal/cmd/server/volume/list/list.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,8 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
7171
if err != nil {
7272
return fmt.Errorf("list server volumes: %w", err)
7373
}
74-
volumes := *resp.Items
75-
if len(volumes) == 0 {
76-
params.Printer.Info("No volumes found for server %s\n", serverLabel)
77-
return nil
78-
}
74+
75+
volumes := resp.GetItems()
7976

8077
// get volume names
8178
var volumeNames []string
@@ -124,6 +121,10 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APICli
124121

125122
func outputResult(p *print.Printer, outputFormat, serverLabel string, volumeNames []string, volumes []iaas.VolumeAttachment) error {
126123
return p.OutputResult(outputFormat, volumes, func() error {
124+
if len(volumes) == 0 {
125+
p.Outputf("No volumes found for server %s\n", serverLabel)
126+
return nil
127+
}
127128
table := tables.NewTable()
128129
table.SetHeader("SERVER ID", "SERVER NAME", "VOLUME ID", "VOLUME NAME")
129130
for i := range volumes {

0 commit comments

Comments
 (0)