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

Support non-TTY Stdin for Confirmation prompts #127

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

john-odonnell
Copy link
Contributor

@john-odonnell john-odonnell commented Apr 19, 2023

Desired Outcome

Being unable to pipe responses to prompts is a known shortcoming of Survey: AlecAivazis/survey#394. We frequently pipe 'yes' responses to CLI confirmation prompts, and this commit supports ONLY those cases.

Implemented Changes

  • func basicConfirm(message string) bool, which uses standard fmt functions to prompt and collect confirmation responses.
  • Unit tests for confirmations use Pipe-based Stdin, instead of a PTY.

Connected Issue/Story

N/A

Definition of Done

At least 1 todo must be completed in the sections below for the PR to be
merged.

Changelog

  • The CHANGELOG has been updated, or
  • This PR does not include user-facing changes and doesn't require a
    CHANGELOG update

Test coverage

  • This PR includes new unit and integration tests to go with the code
    changes, or
  • The changes in this PR do not require tests

Documentation

  • Docs (e.g. READMEs) were updated in this PR
  • A follow-up issue to update official docs has been filed here: [insert issue ID]
  • This PR does not require updating any documentation

Behavior

  • This PR changes product behavior and has been reviewed by a PO, or
  • These changes are part of a larger initiative that will be reviewed later, or
  • No behavior was changed with this PR

Security

  • Security architect has reviewed the changes in this PR,
  • These changes are part of a larger initiative with a separate security review, or
  • There are no security aspects to these changes

@john-odonnell john-odonnell requested a review from a team as a code owner April 19, 2023 14:32
@john-odonnell john-odonnell force-pushed the confirm-prompt-bugfix branch 3 times, most recently from b09bd2b to 9299947 Compare April 19, 2023 14:56
Copy link
Contributor

@gl-johnson gl-johnson left a comment

Choose a reason for hiding this comment

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

Couple small comments/nits but otherwise LGTM

## [8.0.8] - 2023-04-19

### Fixed
- Fixed piping input to `conjur init` confirmation prompts
Copy link
Contributor

Choose a reason for hiding this comment

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

May be worth checking with @szh if he will be re-releasing v8.0.7 with this fix

Copy link
Contributor

Choose a reason for hiding this comment

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

I released 8.0.7 yesterday but am hoping to squeeze in 8.0.0 if I can before the end of the week

pkg/cmd/utils_test.go Outdated Show resolved Hide resolved
Being unable to pipe responses to prompts is a known shortcoming
of Survey: AlecAivazis/survey#394.
We frequently pipe 'yes' responses to CLI confirmation prompts,
and this commit supports ONLY those cases.
@codeclimate
Copy link

codeclimate bot commented Apr 19, 2023

Code Climate has analyzed commit f0eedb4 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 81.4% (0.0% change).

View more on Code Climate.

Copy link
Contributor

@gl-johnson gl-johnson left a comment

Choose a reason for hiding this comment

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

LGTM

@john-odonnell john-odonnell merged commit 3b8c15b into master Apr 19, 2023
@john-odonnell john-odonnell deleted the confirm-prompt-bugfix branch April 19, 2023 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants