File tree 3 files changed +22
-0
lines changed 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import (
19
19
collectrunner "github.com/replicatedhq/troubleshoot/pkg/collect"
20
20
"github.com/replicatedhq/troubleshoot/pkg/logger"
21
21
"github.com/spf13/viper"
22
+ "github.com/tj/go-spin"
22
23
"gopkg.in/yaml.v2"
23
24
corev1 "k8s.io/api/core/v1"
24
25
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -69,6 +70,22 @@ func runPreflightsNoCRD(v *viper.Viper, arg string) error {
69
70
return fmt .Errorf ("unable to parse %s as a preflight" , arg )
70
71
}
71
72
73
+ s := spin .New ()
74
+ finishedCh := make (chan bool , 1 )
75
+ go func () {
76
+ for {
77
+ select {
78
+ case <- finishedCh :
79
+ return
80
+ case <- time .After (time .Millisecond * 100 ):
81
+ fmt .Printf ("\r \033 [36mRunning Preflight checks\033 [m %s " , s .Next ())
82
+ }
83
+ }
84
+ }()
85
+ defer func () {
86
+ finishedCh <- true
87
+ }()
88
+
72
89
allCollectedData , err := runCollectors (v , preflight )
73
90
if err != nil {
74
91
return err
@@ -104,6 +121,8 @@ func runPreflightsNoCRD(v *viper.Viper, arg string) error {
104
121
analyzeResults = append (analyzeResults , analyzeResult )
105
122
}
106
123
124
+ finishedCh <- true
125
+
107
126
if preflight .Spec .UploadResultsTo != "" {
108
127
tryUploadResults (preflight .Spec .UploadResultsTo , preflight .Name , analyzeResults )
109
128
}
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ require (
31
31
github.com/spf13/cobra v0.0.3
32
32
github.com/spf13/viper v1.4.0
33
33
github.com/stretchr/testify v1.3.0
34
+ github.com/tj/go-spin v1.1.0
34
35
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
35
36
github.com/xo/dburl v0.0.0-20190203050942-98997a05b24f // indirect
36
37
golang.org/x/net v0.0.0-20190522155817-f3200d17e092
Original file line number Diff line number Diff line change @@ -420,6 +420,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
420
420
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q =
421
421
github.com/stretchr/testify v1.3.0 /go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI =
422
422
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07 /go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA =
423
+ github.com/tj/go-spin v1.1.0 h1:lhdWZsvImxvZ3q1C5OIB7d72DuOwP4O2NdBg9PyzNds =
424
+ github.com/tj/go-spin v1.1.0 /go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4 =
423
425
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 /go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U =
424
426
github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9 /go.mod h1:q+QjxYvZ+fpjMXqs+XEriussHjSYqeXVnAdSV1tkMYk =
425
427
github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw =
You can’t perform that action at this time.
0 commit comments