Skip to content

Commit 84bed86

Browse files
authored
Fix network-interface output (#585)
If no interfaces are attached to the network display the name in the message Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
1 parent a2ccc0c commit 84bed86

File tree

1 file changed

+7
-1
lines changed
  • internal/cmd/beta/network-interface/list

1 file changed

+7
-1
lines changed

internal/cmd/beta/network-interface/list/list.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1414
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1515
"github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
16+
iaasUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/utils"
1617
"github.com/stackitcloud/stackit-cli/internal/pkg/tables"
1718
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
1819

@@ -77,7 +78,12 @@ func NewCmd(p *print.Printer) *cobra.Command {
7778
}
7879

7980
if resp.Items == nil || len(*resp.Items) == 0 {
80-
p.Info("No network interfaces found for network %d\n", model.NetworkId)
81+
networkLabel, err := iaasUtils.GetNetworkName(ctx, apiClient, model.ProjectId, *model.NetworkId)
82+
if err != nil {
83+
p.Debug(print.ErrorLevel, "get network name: %v", err)
84+
networkLabel = *model.NetworkId
85+
}
86+
p.Info("No network interfaces found for network %q\n", networkLabel)
8187
return nil
8288
}
8389

0 commit comments

Comments
 (0)