Skip to content

Commit f884809

Browse files
committed
Enhance rbd ls Command to List Images Without Requiring an Image Name
Signed-off-by: Oded Viner <[email protected]>
1 parent 4f9722a commit f884809

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

cmd/odf/ceph/rbd.go

+11-14
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ package ceph
22

33
import (
44
"github.com/red-hat-storage/odf-cli/cmd/odf/root"
5-
"github.com/rook/kubectl-rook-ceph/pkg/exec"
6-
"github.com/rook/kubectl-rook-ceph/pkg/k8sutil"
7-
"github.com/rook/kubectl-rook-ceph/pkg/logging"
5+
"github.com/rook/kubectl-rook-ceph/pkg/rbd"
86
"github.com/spf13/cobra"
97
)
108

@@ -14,17 +12,16 @@ var RbdCmd = &cobra.Command{
1412
Short: "call a 'rbd' CLI command with arbitrary args",
1513
DisableFlagParsing: true,
1614
Args: cobra.MinimumNArgs(1),
17-
Run: func(cmd *cobra.Command, args []string) {
18-
logging.Info("running 'rbd' command with args: %v", args)
19-
// verify operator pod is running
20-
_, err := k8sutil.WaitForPodToRun(cmd.Context(), root.ClientSets.Kube, root.OperatorNamespace, "app=rook-ceph-operator")
21-
if err != nil {
22-
logging.Fatal(err)
23-
}
15+
}
2416

25-
_, err = exec.RunCommandInOperatorPod(cmd.Context(), root.ClientSets, cmd.Use, args, root.OperatorNamespace, root.StorageClusterNamespace, false)
26-
if err != nil {
27-
logging.Fatal(err)
28-
}
17+
var listCmdRbd = &cobra.Command{
18+
Use: "ls",
19+
Short: "Print the list of rbd images.",
20+
Run: func(cmd *cobra.Command, args []string) {
21+
rbd.ListImages(cmd.Context(), root.ClientSets, root.OperatorNamespace, root.StorageClusterNamespace)
2922
},
3023
}
24+
25+
func init() {
26+
RbdCmd.AddCommand(listCmdRbd)
27+
}

0 commit comments

Comments
 (0)