Skip to content

Commit

Permalink
Simplify the flow by only user promp in verify
Browse files Browse the repository at this point in the history
  • Loading branch information
tnederlof committed May 2, 2023
1 parent 785d4f6 commit 650fcb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ You can also pass the `--step` flag to begin at a certain spot in the interactiv
sudo wbi setup --step workbench
```

The following steps are valid options: start, prereqs, user, firewall, security, languages, r, python, workbench, license, jupyter, prodrivers, ssl, packagemanager, connect, restart, status, verify.
The following steps are valid options: start, prereqs, firewall, security, languages, r, python, workbench, license, jupyter, prodrivers, ssl, packagemanager, connect, restart, status, verify.

## Assumptions
- Single server
Expand Down
21 changes: 5 additions & 16 deletions cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,6 @@ func newSetup(setupOpts setupOpts) error {
if err != nil {
return err
}
step = "user"
}

var username string
if step == "user" {
username, err = operatingsystem.PromptAndVerifyUser()
if err != nil {
return err
}
step = "firewall"
}

Expand Down Expand Up @@ -282,11 +273,9 @@ func newSetup(setupOpts setupOpts) error {
return fmt.Errorf("issue selecting if verification is to be run: %w", err)
}
if verifyChoice {
if username == "" {
username, err = operatingsystem.PromptAndVerifyUser()
if err != nil {
return err
}
username, err := operatingsystem.PromptAndVerifyUser()
if err != nil {
return err
}
err = workbench.VerifyInstallation(username)
if err != nil {
Expand Down Expand Up @@ -326,7 +315,7 @@ func (opts *setupOpts) Validate(args []string) error {
return fmt.Errorf("no arguments are supported for this command")
}
// ensure step is valid
validSteps := []string{"start", "prereqs", "user", "firewall", "security", "languages", "r", "python", "workbench", "license", "jupyter", "prodrivers", "ssl", "packagemanager", "connect", "restart", "status", "verify"}
validSteps := []string{"start", "prereqs", "firewall", "security", "languages", "r", "python", "workbench", "license", "jupyter", "prodrivers", "ssl", "packagemanager", "connect", "restart", "status", "verify"}
if opts.step != "" && !lo.Contains(validSteps, opts.step) {
return fmt.Errorf("invalid step: %s", opts.step)
}
Expand Down Expand Up @@ -368,7 +357,7 @@ func newSetupCmd() *setupCmd {
SilenceUsage: true,
}

stepHelp := `The step to start at. Valid steps are: start, prereqs, user, firewall, security, languages, r, python, workbench, license, jupyter, prodrivers, ssl, packagemanager, connect, restart, status, verify.`
stepHelp := `The step to start at. Valid steps are: start, prereqs, firewall, security, languages, r, python, workbench, license, jupyter, prodrivers, ssl, packagemanager, connect, restart, status, verify.`

cmd.Flags().StringP("step", "s", "", stepHelp)
viper.BindPFlag("step", cmd.Flags().Lookup("step"))
Expand Down

0 comments on commit 650fcb7

Please sign in to comment.