mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-04-27 11:21:44 +00:00
art: Allow the agent to self-restart on error
In init systems that don't support automatic restart this might be handy when we fail because we boot up too fast. This is an attempt to fix https://github.com/c3os-io/c3os/issues/47
This commit is contained in:
parent
c8244f7dbd
commit
fe08c577ed
@ -100,6 +100,9 @@ Starts the c3os agent which automatically bootstrap and advertize to the c3os ne
|
||||
`,
|
||||
Aliases: []string{"s"},
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "restart",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "force",
|
||||
},
|
||||
@ -115,7 +118,20 @@ Starts the c3os agent which automatically bootstrap and advertize to the c3os ne
|
||||
dirs = args
|
||||
}
|
||||
|
||||
return agent.Run(c.String("api"), dirs, c.Bool("force"))
|
||||
opts := []agent.Option{
|
||||
agent.WithAPI(c.String("api")),
|
||||
agent.WithDirectory(dirs...),
|
||||
}
|
||||
|
||||
if c.Bool("force") {
|
||||
opts = append(opts, agent.ForceAgent)
|
||||
}
|
||||
|
||||
if c.Bool("restart") {
|
||||
opts = append(opts, agent.RestartAgent)
|
||||
}
|
||||
|
||||
return agent.Run(opts...)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user