Separate out memory statistics and system information into two different services

This commit is contained in:
Harshavardhana
2015-07-07 16:59:20 -07:00
parent 8abb96c030
commit 676b9058de
4 changed files with 58 additions and 12 deletions

View File

@@ -101,7 +101,7 @@ func runController(c *cli.Context) {
if err != nil {
Fatalf("Unable to determine current user. Reason: %s\n", err)
}
if len(c.Args()) <= 2 || c.Args().First() == "help" {
if len(c.Args()) < 2 || c.Args().First() == "help" {
cli.ShowCommandHelpAndExit(c, "controller", 1) // last argument is exit code
}
switch c.Args().First() {
@@ -117,7 +117,16 @@ func runController(c *cli.Context) {
Fatalln(err)
}
Println(string(memstats))
case "sysinfo":
sysinfo, err := controller.GetSysInfo(c.Args().Tail().First())
if err != nil {
Fatalln(err)
}
Println(string(sysinfo))
case "donut":
if len(c.Args()) <= 2 || c.Args().First() == "help" {
cli.ShowCommandHelpAndExit(c, "controller", 1) // last argument is exit code
}
hostname, _ := os.Hostname()
err := controller.SetDonut(c.Args().Tail().First(), hostname, c.Args().Tail().Tail())
if err != nil {