aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-08-16 18:19:01 +0800
committerGitHub <noreply@github.com>2018-08-16 18:19:01 +0800
commit5952d962dc6852fe62f0d363317dae2f224063bd (patch)
tree295eda70964c6a14175bc7f19389a829c1882d5d
parent2cdf6ee7e00d6127c372e7a28bb27a80ef495cb2 (diff)
parentb24fb76a3ae8b2a41bde9ed0744b4284e385e011 (diff)
downloaddexon-5952d962dc6852fe62f0d363317dae2f224063bd.tar
dexon-5952d962dc6852fe62f0d363317dae2f224063bd.tar.gz
dexon-5952d962dc6852fe62f0d363317dae2f224063bd.tar.bz2
dexon-5952d962dc6852fe62f0d363317dae2f224063bd.tar.lz
dexon-5952d962dc6852fe62f0d363317dae2f224063bd.tar.xz
dexon-5952d962dc6852fe62f0d363317dae2f224063bd.tar.zst
dexon-5952d962dc6852fe62f0d363317dae2f224063bd.zip
Merge pull request #17412 from karalabe/puppeth-fix-dial-panic
cmd/puppeth: fix nil panic on disconnected stats gathering
-rw-r--r--cmd/puppeth/wizard_netstats.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd/puppeth/wizard_netstats.go b/cmd/puppeth/wizard_netstats.go
index 89b38e262..99ca11bb1 100644
--- a/cmd/puppeth/wizard_netstats.go
+++ b/cmd/puppeth/wizard_netstats.go
@@ -82,7 +82,6 @@ func (w *wizard) gatherStats(server string, pubkey []byte, client *sshClient) *s
logger.Info("Starting remote server health-check")
stat := &serverStat{
- address: client.address,
services: make(map[string]map[string]string),
}
if client == nil {
@@ -94,6 +93,8 @@ func (w *wizard) gatherStats(server string, pubkey []byte, client *sshClient) *s
}
client = conn
}
+ stat.address = client.address
+
// Client connected one way or another, run health-checks
logger.Debug("Checking for nginx availability")
if infos, err := checkNginx(client, w.network); err != nil {
@@ -214,6 +215,9 @@ func (stats serverStats) render() {
if len(stat.address) > len(separator[1]) {
separator[1] = strings.Repeat("-", len(stat.address))
}
+ if len(stat.failure) > len(separator[1]) {
+ separator[1] = strings.Repeat("-", len(stat.failure))
+ }
for service, configs := range stat.services {
if len(service) > len(separator[2]) {
separator[2] = strings.Repeat("-", len(service))
@@ -250,7 +254,11 @@ func (stats serverStats) render() {
sort.Strings(services)
if len(services) == 0 {
- table.Append([]string{server, stats[server].address, "", "", ""})
+ if stats[server].failure != "" {
+ table.Append([]string{server, stats[server].failure, "", "", ""})
+ } else {
+ table.Append([]string{server, stats[server].address, "", "", ""})
+ }
}
for j, service := range services {
// Add an empty line between all services