Merge pull request #779 from nalind/kpod-debug-flag
kpod: make --debug work
This commit is contained in:
commit
c9d27ad111
2 changed files with 7 additions and 5 deletions
|
@ -7,7 +7,6 @@ import (
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/fatih/camelcase"
|
"github.com/fatih/camelcase"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod"
|
"github.com/kubernetes-incubator/cri-o/libkpod"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -50,9 +49,6 @@ func getConfig(c *cli.Context) (*libkpod.Config, error) {
|
||||||
config.StorageOptions = opts
|
config.StorageOptions = opts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if c.Bool("debug") {
|
|
||||||
logrus.SetLevel(logrus.DebugLevel)
|
|
||||||
}
|
|
||||||
if c.GlobalIsSet("runtime") {
|
if c.GlobalIsSet("runtime") {
|
||||||
config.Runtime = c.GlobalString("runtime")
|
config.Runtime = c.GlobalString("runtime")
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ func main() {
|
||||||
if reexec.Init() {
|
if reexec.Init() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
logrus.SetLevel(logrus.ErrorLevel)
|
|
||||||
|
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "kpod"
|
app.Name = "kpod"
|
||||||
|
@ -44,6 +43,13 @@ func main() {
|
||||||
statsCommand,
|
statsCommand,
|
||||||
loadCommand,
|
loadCommand,
|
||||||
}
|
}
|
||||||
|
app.Before = func(c *cli.Context) error {
|
||||||
|
logrus.SetLevel(logrus.ErrorLevel)
|
||||||
|
if c.GlobalBool("debug") {
|
||||||
|
logrus.SetLevel(logrus.DebugLevel)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "config, c",
|
Name: "config, c",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue