Skip to content

Commit

Permalink
removed no containers found
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus committed May 12, 2022
1 parent d13c9bf commit 5f81584
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions cmd/inspect.go
Expand Up @@ -15,7 +15,6 @@ import (
"strings"

"github.com/olekukonko/tablewriter"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/srl-labs/containerlab/clab"
"github.com/srl-labs/containerlab/nodes"
Expand Down Expand Up @@ -80,10 +79,6 @@ var inspectCmd = &cobra.Command{
return fmt.Errorf("failed to list containers: %s", err)
}

if len(containers) == 0 {
log.Println("no containers found")
return nil
}
if details {
b, err := json.MarshalIndent(containers, "", " ")
if err != nil {
Expand Down Expand Up @@ -164,7 +159,7 @@ func printContainerInspect(c *clab.CLab, containers []types.GenericContainer, fo
})

if format == "json" {
resultJson := &types.JsonInspect{ContainerData: contDetails, MySocketIoData: nil}
resultJson := &types.JsonInspect{ContainerData: contDetails, MySocketIoData: []*types.MySocketIoEntry{}}
if printMysocket {
// search for the mysocketio token file by deducing it from the topology config binds section
tokenFile, err := deduceMySocketIoTokenFileFromBindMounts(c.Nodes, c.TopoFile.GetDir())
Expand Down

0 comments on commit 5f81584

Please sign in to comment.