From e61689650e7270c93fb8c9191df2861bc3a95866 Mon Sep 17 00:00:00 2001 From: Valentin Pichard Date: Fri, 4 Jan 2019 17:26:36 +0100 Subject: [PATCH] Replace state of env by description Signed-off-by: Valentin Pichard --- helper/client.go | 2 +- helper/status.go | 10 ++++++---- puma-helper.yaml | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/helper/client.go b/helper/client.go index dc18de5..11fa4d1 100644 --- a/helper/client.go +++ b/helper/client.go @@ -2,7 +2,7 @@ package helper type Application struct { Path string `mapstructure:"path"` - State string `mapstructure:"state"` + Description string `mapstructure:"description"` PumactlPath string `mapstructure:"pumactlpath"` PumastatePath string `mapstructure:"pumastatepath"` } diff --git a/helper/status.go b/helper/status.go index 589ed39..e300b59 100644 --- a/helper/status.go +++ b/helper/status.go @@ -69,7 +69,7 @@ func printApplicationsContext(pst pumaStatus) error { fmt.Printf("* PID: %d\tBooted: %t\t\tRunner index: %d\n", key.Pid, key.Booted, key.Index) fmt.Printf("\t- Last status %s -\n", timeElapsed(key.LastCheckin)) fmt.Printf(" Running: %d\tPool capacity: %d\tMax threads: %d\n", key.LastStatus.Running, key.LastStatus.PoolCapacity, key.LastStatus.MaxThreads) - fmt.Printf(" CPU: %s%%\tMemory: %s MiB\tTotal time exec: %s\n", cpu, mem, timeElapsed(time.Now().Add(time.Duration(-int64(ttime))*time.Second).Format(time.RFC3339))) + fmt.Printf(" CPU: %s%%\tMemory: %s MiB\tTotal exec time: %s\n", cpu, mem, timeElapsed(time.Now().Add(time.Duration(-int64(ttime))*time.Second).Format(time.RFC3339))) } return nil @@ -106,7 +106,6 @@ func readPumaStats(key Application) (pumaStatus, error) { func printApplicationGroups() error { fmt.Println("----------- Application groups -----------") - fmt.Println() line := 0 for appname, key := range CfgFile.Applications { @@ -115,7 +114,10 @@ func printApplicationGroups() error { return err } - fmt.Printf("-> %s application (%s)\n", appname, key.State) + fmt.Printf("-> %s application\n", appname) + if key.Description != "" { + fmt.Printf(" About: %s\n", key.Description) + } fmt.Printf(" App root: %s\n", key.Path) fmt.Printf(" Booted workers: %d\n\n", ps.BootedWorkers) @@ -123,7 +125,7 @@ func printApplicationGroups() error { return err } - for line < len(CfgFile.Applications) { + if line < len(CfgFile.Applications)-1 { fmt.Println() line++ } diff --git a/puma-helper.yaml b/puma-helper.yaml index ff1d0df..90cd6c7 100644 --- a/puma-helper.yaml +++ b/puma-helper.yaml @@ -1,11 +1,11 @@ applications: "mobile-chat": path : "/home/mobile-chat" - state : "production" + description : "Related to mobile-chat production system" #pumactlpath : "/home/mobile-chat/current/bin/pumactl" #pumastatepath : "/home/mobile-chat/current/tmp/pids/puma_state" "ideas": path : "/home/ideas" - state : "production" + description : "Related to ideas staging env" #pumactlpath : "/home/ideas/current/bin/pumactl" #pumastatepath : "/home/ideas/current/tmp/pids/puma_state" \ No newline at end of file