Skip to content

Commit 9ca7a0e

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 9ca7a0e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cmd/odf/ceph/rbd.go

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/rook/kubectl-rook-ceph/pkg/exec"
66
"github.com/rook/kubectl-rook-ceph/pkg/k8sutil"
77
"github.com/rook/kubectl-rook-ceph/pkg/logging"
8+
"github.com/rook/kubectl-rook-ceph/pkg/rbd"
89
"github.com/spf13/cobra"
910
)
1011

@@ -21,6 +22,15 @@ var RbdCmd = &cobra.Command{
2122
if err != nil {
2223
logging.Fatal(err)
2324
}
25+
// If the user is trying to run "rbd ls" (without possible extra arguments)
26+
if args[0] == "ls" && len(args) == 1 {
27+
if len(args) > 1 {
28+
logging.Warning("Ignoring extra arguments for 'rbd ls'; running only 'rbd ls'.")
29+
}
30+
// Call the vendor ListImages function to do the listing
31+
rbd.ListImages(cmd.Context(), root.ClientSets, root.OperatorNamespace, root.StorageClusterNamespace)
32+
return
33+
}
2434

2535
_, err = exec.RunCommandInOperatorPod(cmd.Context(), root.ClientSets, cmd.Use, args, root.OperatorNamespace, root.StorageClusterNamespace, false)
2636
if err != nil {

0 commit comments

Comments
 (0)