File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,6 +153,14 @@ it means it can act like an access node to user private networks
153153
154154The next set of commands are ONLY possible to be called by the ` farmer ` only.
155155
156+ ### Reboot
157+
158+ | command | body| return|
159+ | ---| ---| ---|
160+ | ` zos.admin.reboot ` | - | - |
161+
162+ Stops all services then reboot the node
163+
156164### List Physical Interfaces
157165
158166| command | body| return|
Original file line number Diff line number Diff line change @@ -4,8 +4,16 @@ import (
44 "context"
55 "encoding/json"
66 "fmt"
7+
8+ "github.com/threefoldtech/zos/pkg/zinit"
79)
810
11+ func (g * ZosAPI ) adminRebootHandler (ctx context.Context , payload []byte ) (interface {}, error ) {
12+ zinit := zinit .Default ()
13+
14+ return nil , zinit .Reboot ()
15+ }
16+
917func (g * ZosAPI ) adminInterfacesHandler (ctx context.Context , payload []byte ) (interface {}, error ) {
1018 // list all interfaces on node
1119 type Interface struct {
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ func (g *ZosAPI) SetupRoutes(router *peer.Router) {
4545
4646 admin := root .SubRoute ("admin" )
4747 admin .Use (g .authorized )
48+ admin .WithHandler ("reboot" , g .adminRebootHandler )
4849 admin .WithHandler ("interfaces" , g .adminInterfacesHandler )
4950 admin .WithHandler ("set_public_nic" , g .adminSetPublicNICHandler )
5051 admin .WithHandler ("get_public_nic" , g .adminGetPublicNICHandler )
You can’t perform that action at this time.
0 commit comments