Skip to content

Commit db893d8

Browse files
author
Jeff McCormick
committed
fix pgo show backup mycluster output
1 parent b029126 commit db893d8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

client/cmd/backup.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,14 @@ func showItem(name string, pvcName string) {
9393
}
9494

9595
//print the database pod if it exists
96-
var pod *v1.Pod
97-
pod, err = Clientset.Core().Pods(api.NamespaceDefault).Get(name)
98-
if err != nil {
96+
lo = v1.ListOptions{LabelSelector: "name=" + name}
97+
log.Debug("label selector is " + lo.LabelSelector)
98+
dbpods, err := Clientset.Core().Pods(api.NamespaceDefault).List(lo)
99+
if err != nil || len(dbpods.Items) == 0{
99100
fmt.Printf("\ndatabase pod %s\n", name+" is not found")
100101
fmt.Println(err.Error())
101102
} else {
102-
fmt.Printf("\ndatabase pod %s\n", pod.Name+" is found")
103+
fmt.Printf("\ndatabase pod %s\n", name+" is found")
103104
}
104105

105106
fmt.Println("")

0 commit comments

Comments
 (0)