Skip to content

Commit e2b68db

Browse files
feat: replace warn calls with print (#62)
it is weird to have logrus warn messages being printed during the installs. this pr replaces them with fmt.print calls.
1 parent c3ab895 commit e2b68db

File tree

6 files changed

+18
-20
lines changed

6 files changed

+18
-20
lines changed

cmd/helmvm/install.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func runHostPreflights(c *cli.Context) error {
8787
if !outputs.HaveWarns() || c.Bool("no-prompt") {
8888
return nil
8989
}
90-
logrus.Warn("Host preflights have warnings on one or more hosts")
90+
fmt.Println("Host preflights have warnings on one or more hosts")
9191
if !prompts.New().Confirm("Do you want to continue ?", false) {
9292
return fmt.Errorf("user aborted")
9393
}
@@ -196,10 +196,10 @@ func copyUserProvidedConfig(c *cli.Context) error {
196196
// overwriteExistingConfig asks user if they want to overwrite the existing cluster
197197
// configuration file.
198198
func overwriteExistingConfig() bool {
199-
logrus.Warn("A cluster configuration file was found. This means you already")
200-
logrus.Warn("have created and configured a cluster. You can either use the")
201-
logrus.Warn("existing configuration or create a new one (the original config")
202-
logrus.Warn("will be backed up).")
199+
fmt.Println("A cluster configuration file was found. This means you already")
200+
fmt.Println("have created and configured a cluster. You can either use the")
201+
fmt.Println("existing configuration or create a new one (the original config")
202+
fmt.Println("will be backed up).")
203203
return prompts.New().Confirm(
204204
"Do you want to create a new cluster configuration ?", false,
205205
)
@@ -381,9 +381,9 @@ var installCommand = &cli.Command{
381381
},
382382
Action: func(c *cli.Context) error {
383383
if defaults.DecentralizedInstall() {
384-
logrus.Warnf("Decentralized install was detected. To manage the cluster")
385-
logrus.Warnf("you have to use the '%s node' commands instead.", defaults.BinaryName())
386-
logrus.Warnf("Run '%s node --help' for more information.", defaults.BinaryName())
384+
fmt.Println("Decentralized install was detected. To manage the cluster")
385+
fmt.Printf("you have to use the '%s node' commands instead.\n", defaults.BinaryName())
386+
fmt.Printf("Run '%s node --help' for more information.\n", defaults.BinaryName())
387387
return fmt.Errorf("decentralized install detected")
388388
}
389389
useprompt := !c.Bool("no-prompt")

cmd/helmvm/token.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ var tokenCreateCommand = &cli.Command{
6565
}
6666
logrus.Infof("Creating node join token for role %s", role)
6767
if !defaults.DecentralizedInstall() {
68-
logrus.Warn("You are opting out of the centralized cluster management.")
69-
logrus.Warn("Through the centralized management you can manage all your")
70-
logrus.Warn("cluster nodes from a single location. If you decide to move")
71-
logrus.Warn("on the centralized management won't be available anymore")
68+
fmt.Println("You are opting out of the centralized cluster management.")
69+
fmt.Println("Through the centralized management you can manage all your")
70+
fmt.Println("cluster nodes from a single location. If you decide to move")
71+
fmt.Println("on the centralized management won't be available anymore")
7272
if useprompt && !prompts.New().Confirm("Do you want to continue ?", true) {
7373
return nil
7474
}

cmd/helmvm/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func runHostPreflightsLocally(c *cli.Context) error {
8181
if !out.HasWarn() || c.Bool("no-prompt") {
8282
return nil
8383
}
84-
logrus.Warn("Host preflights have warnings on one or more hosts")
84+
fmt.Println("Host preflights have warnings on one or more hosts")
8585
if !prompts.New().Confirm("Do you want to continue ?", false) {
8686
return fmt.Errorf("user aborted")
8787
}

pkg/addons/adminconsole/adminconsole.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"strings"
99

1010
"github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
11-
"github.com/sirupsen/logrus"
1211
"golang.org/x/mod/semver"
1312
"helm.sh/helm/v3/pkg/action"
1413
"helm.sh/helm/v3/pkg/chart/loader"
@@ -43,7 +42,7 @@ type AdminConsole struct {
4342

4443
func (a *AdminConsole) askPassword() (string, error) {
4544
if !a.useprompt {
46-
logrus.Warnf("Admin Console password set to: password")
45+
fmt.Println("Admin Console password set to: password")
4746
return "password", nil
4847
}
4948
return prompts.New().Password("Enter a new Admin Console password:"), nil

pkg/config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func askUserForHostConfig(keys []string, host *hostcfg) error {
109109
for port == 0 {
110110
str := quiz.Input("SSH port:", strconv.Itoa(host.Port), true)
111111
if port, err = strconv.Atoi(str); err != nil {
112-
logrus.Warnf("Invalid port number")
112+
fmt.Println("Invalid port number")
113113
}
114114
}
115115
host.Port = port
@@ -133,8 +133,8 @@ func collectHostConfig(host hostcfg) (*cluster.Host, error) {
133133
}
134134
logrus.Infof("Testing SSH connection to %s", host.Address)
135135
if err := host.testConnection(); err != nil {
136-
logrus.Warnf("Unable to connect to %s", host.Address)
137-
logrus.Warnf("Please check the provided SSH configuration.")
136+
fmt.Printf("Unable to connect to %s\n", host.Address)
137+
fmt.Println("Please check the provided SSH configuration.")
138138
continue
139139
}
140140
logrus.Infof("SSH connection to %s successful", host.Address)

pkg/infra/infra.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"github.com/hashicorp/terraform-exec/tfexec"
1111
"github.com/jedib0t/go-pretty/table"
12-
"github.com/sirupsen/logrus"
1312

1413
"github.com/replicatedhq/helmvm/pkg/defaults"
1514
pb "github.com/replicatedhq/helmvm/pkg/progressbar"
@@ -56,7 +55,7 @@ func Apply(ctx context.Context, dir string, useprompt bool) ([]Node, error) {
5655
// printNodes prints the nodes to stdout in a table.
5756
func printNodes(nodes []Node) {
5857
if len(nodes) == 0 {
59-
logrus.Warnf("No node found in terraform output")
58+
fmt.Println("No node found in terraform output")
6059
return
6160
}
6261
fmt.Println("These are the nodes configuration applied by your configuration:")

0 commit comments

Comments
 (0)