-
Notifications
You must be signed in to change notification settings - Fork 1
/
list.go
37 lines (34 loc) · 928 Bytes
/
list.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"fmt"
"github.com/codegangsta/cli"
)
func list(c *cli.Context) error {
paks, err := pakManager.List(c.GlobalString("namespace"))
if err != nil {
return cli.NewExitError(fmt.Sprintf("error in fetching installed paks: %v", err.Error()), -1)
}
for i := range paks {
fmt.Printf("Pak URL: %s\n", paks[i].PakURL)
fmt.Printf("Group: %s\n", paks[i].Group)
fmt.Printf("Objects:\n")
for j := range paks[i].Objects {
obj := paks[i].Objects[j]
md, _ := obj.Metadata()
fmt.Printf("\t(%s) %s\n", md.Kind, md.Name)
if md.Kind == "Pod" {
status, _ := obj.Status()
fmt.Printf("\t State: %s\n", status.Phase)
fmt.Printf("\t Pod IP: %s\n", status.PodIP)
if status.Reason != "" {
fmt.Printf("\t Reason: %s\n", status.Reason)
}
if status.Message != "" {
fmt.Printf("\t Message: %s\n", status.Message)
}
}
}
fmt.Println()
}
return nil
}