From 9f76de2a11618a85702175a33e304ac9820b03c5 Mon Sep 17 00:00:00 2001 From: ykomissarov Date: Wed, 18 Dec 2019 12:45:06 +0300 Subject: [PATCH] print module version in `status` command --- .version | 2 +- CHANGELOG.md | 2 ++ command/status.go | 12 ++++-------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.version b/.version index 227cea2..38f77a6 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.0.0 +2.0.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7cc58..081eedf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## v2.0.1 +* print module version in `status` command ## v2.0.0 * add integration with isp-config-service 2.0 ## v1.2.4 diff --git a/command/status.go b/command/status.go index db7a375..7dea233 100644 --- a/command/status.go +++ b/command/status.go @@ -8,6 +8,7 @@ import ( "isp-ctl/flag" "isp-ctl/service" "os" + "strings" ) const ( @@ -45,16 +46,11 @@ func (statusCommand) action(ctx *cli.Context) { for _, module := range arrayOfModules { addresses := "" connection := tableNotConnectedStatus + instanceList := make([]string, 0, len(module.Status)) for _, value := range module.Status { - if value.Address.IP == "" && value.Address.Port == "" { - continue - } - if addresses == "" { - addresses = fmt.Sprintf("%s:%s;", value.Address.IP, value.Address.Port) - } else { - addresses = fmt.Sprintf("%s\n%s:%s;", addresses, value.Address.IP, value.Address.Port) - } + instanceList = append(instanceList, fmt.Sprintf("%s %s", value.Address.GetAddress(), value.Version)) } + addresses = strings.Join(instanceList, "\n") if addresses != "" { connection = tableConnectedStatus }