(operation string)
| 56 | } |
| 57 | |
| 58 | func (u *DashboardService) Restart(operation string) error { |
| 59 | switch operation { |
| 60 | case "system": |
| 61 | { |
| 62 | go func() { |
| 63 | cmdMgr := cmd.NewCommandMgr() |
| 64 | err := cmdMgr.RunWithOptionalSudo("reboot") |
| 65 | if err != nil { |
| 66 | global.LOG.Errorf("handle reboot failed, %v", err) |
| 67 | } |
| 68 | }() |
| 69 | return nil |
| 70 | } |
| 71 | case "1panel-agent": |
| 72 | controller.RestartPanel(false, true, false) |
| 73 | return nil |
| 74 | case "1panel": |
| 75 | controller.RestartPanel(true, true, false) |
| 76 | return nil |
| 77 | default: |
| 78 | return fmt.Errorf("handle restart operation %s failed, err: nonsupport such operation", operation) |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | func (u *DashboardService) LoadOsInfo() (*dto.OsInfo, error) { |
| 83 | var baseInfo dto.OsInfo |
nothing calls this directly
no test coverage detected