Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't assume bash when displaying interactive CLI prompts #21839

Merged
merged 1 commit into from
Jul 14, 2021

Conversation

danxmoran
Copy link
Contributor

@danxmoran danxmoran commented Jul 13, 2021

Closes #21838

Requires influxdata/influx-cli#192 to merge first so we can re-update go.mod to point at main

@danxmoran danxmoran force-pushed the dm-upgrade-interactive-prompt-powershell-21838 branch from ddb9b4f to ac22894 Compare July 13, 2021 19:16
@danxmoran
Copy link
Contributor Author

danxmoran commented Jul 13, 2021

Ugh, now needs influxdata/influx-cli#195

AuthToken: options.target.token,
Org: options.target.orgName,
Bucket: options.target.bucket,
Retention: options.target.retention,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit confusing that the prompt appears to be for a different kind of string than the options value now? (nanos vs hours?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The help-text isn't very helpful, but I think the behavior is the same before and after this change. Whatever gets passed to --retention gets parsed as a time.Duration

I can update the description in the help-text to show examples of durations (i.e. 72h)

}
if req.Bucket == "" {
req.Bucket = internal.GetInput(ui, "Please type your primary bucket name", "")
if cliReq.Password != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So for influxdb.OnboardingRequest we don't distinguish between nil and default-value, but for api.OnboardingRequest we do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, a consequence of codegen vs. hand-rolled. The codegen'd models use pointer-fields for every optional field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked on Slack: going to try deleting influxdb.OnboardingRequest and migrating existing code to use the codegen'd model imported from the CLI

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After trying, would prefer to leave it as an adapter layer here. Both influxdb.OnboardingRequest and api.OnboardingRequest embed references to other models from their respective packages; if you change the top-level type, you also have to change how you process all the fields, and it starts to sprawl into many files.

@danxmoran danxmoran force-pushed the dm-upgrade-interactive-prompt-powershell-21838 branch from 4949f0b to 1a982a9 Compare July 14, 2021 20:40
@danxmoran
Copy link
Contributor Author

Reset and force-pushed to clean up the git history, not sure what happened with all the merges from master

@danxmoran danxmoran merged commit fa1c352 into master Jul 14, 2021
@danxmoran danxmoran deleted the dm-upgrade-interactive-prompt-powershell-21838 branch July 14, 2021 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Escape characters break interactive prompts in influxd upgrade in PowerShell
2 participants