From 5c8342365492553842c6e6479c36be3965c2ccbb Mon Sep 17 00:00:00 2001 From: Hans Hasselberg Date: Fri, 18 Jan 2019 11:08:57 +0100 Subject: [PATCH 1/2] display messages from serf in cli --- api/operator_keyring.go | 3 +++ command/keyring/keyring.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/api/operator_keyring.go b/api/operator_keyring.go index 6b614296cead..038d5d5b02fd 100644 --- a/api/operator_keyring.go +++ b/api/operator_keyring.go @@ -16,6 +16,9 @@ type KeyringResponse struct { // Segment has the network segment this request corresponds to. Segment string + // Messages has information or errors from serf + Messages map[string]string `json:",omitempty"` + // A map of the encryption keys to the number of nodes they're installed on Keys map[string]int diff --git a/command/keyring/keyring.go b/command/keyring/keyring.go index 33c3297920ae..33bacee36a6a 100644 --- a/command/keyring/keyring.go +++ b/command/keyring/keyring.go @@ -154,6 +154,11 @@ func (c *cmd) handleList(responses []*consulapi.KeyringResponse) { c.UI.Output("") c.UI.Output(pool + ":") + + for from, msg := range response.Messages { + c.UI.Output(fmt.Sprintf(" ===> %s: %s\n", from, msg)) + } + for key, num := range response.Keys { c.UI.Output(fmt.Sprintf(" %s [%d/%d]", key, num, response.NumNodes)) } From e9c1478fe45e9a7802ac0a08b652c0b9c9d28c8d Mon Sep 17 00:00:00 2001 From: Hans Hasselberg Date: Fri, 18 Jan 2019 14:18:49 +0100 Subject: [PATCH 2/2] remove newline --- command/keyring/keyring.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command/keyring/keyring.go b/command/keyring/keyring.go index 33bacee36a6a..b9a12732a729 100644 --- a/command/keyring/keyring.go +++ b/command/keyring/keyring.go @@ -156,7 +156,7 @@ func (c *cmd) handleList(responses []*consulapi.KeyringResponse) { c.UI.Output(pool + ":") for from, msg := range response.Messages { - c.UI.Output(fmt.Sprintf(" ===> %s: %s\n", from, msg)) + c.UI.Output(fmt.Sprintf(" ===> %s: %s", from, msg)) } for key, num := range response.Keys {