aboutsummaryrefslogtreecommitdiff
path: root/cmd/crioctl/info.go
blob: 1f06f594a06b2aff5238ea3115e71c72f3ef3a3f (plain)
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
package main

import (
	"encoding/json"
	"fmt"

	"github.com/kubernetes-incubator/cri-o/client"
	"github.com/urfave/cli"
)

var infoCommand = cli.Command{
	Name:  "info",
	Usage: "get crio daemon info",
	Action: func(context *cli.Context) error {
		c, err := client.New(context.GlobalString("connect"))
		if err != nil {
			return err
		}
		di, err := c.DaemonInfo()
		if err != nil {
			return err
		}

		jsonBytes, err := json.MarshalIndent(di, "", "    ")
		if err != nil {
			return err
		}
		fmt.Println(string(jsonBytes))
		return nil
	},
}