File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import (
1919 collectrunner "github.com/replicatedhq/troubleshoot/pkg/collect"
2020 "github.com/replicatedhq/troubleshoot/pkg/logger"
2121 "github.com/spf13/viper"
22+ "github.com/tj/go-spin"
2223 "gopkg.in/yaml.v2"
2324 corev1 "k8s.io/api/core/v1"
2425 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -69,6 +70,22 @@ func runPreflightsNoCRD(v *viper.Viper, arg string) error {
6970 return fmt .Errorf ("unable to parse %s as a preflight" , arg )
7071 }
7172
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+
7289 allCollectedData , err := runCollectors (v , preflight )
7390 if err != nil {
7491 return err
@@ -104,6 +121,8 @@ func runPreflightsNoCRD(v *viper.Viper, arg string) error {
104121 analyzeResults = append (analyzeResults , analyzeResult )
105122 }
106123
124+ finishedCh <- true
125+
107126 if preflight .Spec .UploadResultsTo != "" {
108127 tryUploadResults (preflight .Spec .UploadResultsTo , preflight .Name , analyzeResults )
109128 }
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ require (
3131 github.com/spf13/cobra v0.0.3
3232 github.com/spf13/viper v1.4.0
3333 github.com/stretchr/testify v1.3.0
34+ github.com/tj/go-spin v1.1.0
3435 github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
3536 github.com/xo/dburl v0.0.0-20190203050942-98997a05b24f // indirect
3637 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
420420github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q =
421421github.com/stretchr/testify v1.3.0 /go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI =
422422github.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 =
423425github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 /go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U =
424426github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9 /go.mod h1:q+QjxYvZ+fpjMXqs+XEriussHjSYqeXVnAdSV1tkMYk =
425427github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw =
You can’t perform that action at this time.
0 commit comments