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

Enable ECHO in pause module #32083

Merged
merged 3 commits into from
Oct 26, 2017
Merged

Conversation

samdoran
Copy link
Contributor

@samdoran samdoran commented Oct 24, 2017

SUMMARY

When pause.py terminal input code was rewritten, it disabled echo output. This PR flips some bits set my tty.setraw(), reenabling echo output for the prompt module as well as allowing the input to be edited interactively.

Fixes #14160

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/plugins/action/pause.py

ANSIBLE VERSION
2.5
ADDITIONAL INFORMATION

Tested with Python 2.7.14 and Python 3.6.3

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bugfix_pull_request needs_triage Needs a first human triage before being processed. plugins/action python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 24, 2017
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 24, 2017
@bcoca bcoca added this to TODO: Nice to have in 2.4.x Blocker List Oct 24, 2017
@bcoca
Copy link
Member

bcoca commented Oct 24, 2017

+1 ... a followup feature might be adding a 'toggle' to make it private.

@ansibot
Copy link
Contributor

ansibot commented Oct 24, 2017

@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. labels Oct 24, 2017
@samdoran
Copy link
Contributor Author

Added the option to control echo output and several other optimizations. Tested with Python 2.7.14 and 3.6.3.

Also discovered that hitting delete doesn't work. Not sure how to fix that, but probably for another time.

@soumyadipDe
Copy link

It is echoing pressing enter also as ^M. Any way to suppress this?

@@ -40,6 +40,12 @@
- Optional text to use for the prompt message.
required: false
default: null
echo:
description:
Copy link
Member

Choose a reason for hiding this comment

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

version_added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll put 2.4 in the hopes we can get this into 2.4.x

Copy link
Member

Choose a reason for hiding this comment

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

no, in that case , lets split PRs, get fix in 2.4, add echo in 2.5

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do. Ended up doing a lot of polishing or how this behaves.

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Oct 25, 2017
@samdoran
Copy link
Contributor Author

@soumyadipDe I noticed that as well. It doesn't get stored in the registered output, so it's a visual artifact. I'll see about tweaking the flags some more, but I don't want to let that hold up this PR.

@ansibot ansibot removed the needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. label Oct 25, 2017
@ansibot
Copy link
Contributor

ansibot commented Oct 25, 2017

The test ansible-test sanity --test validate-modules [?] failed with the following error:

lib/ansible/modules/utilities/logic/pause.py:0:0: E309 version_added for new option (echo) should be 2.5. Currently 2.4

click here for bot help

@samdoran
Copy link
Contributor Author

@soumyadipDe I set additional flags to hide the ^M as well as allow editing. Please test and let me know if this works for you.

@ansibot ansibot removed the module This issue/PR relates to a module. label Oct 25, 2017
@bcoca
Copy link
Member

bcoca commented Oct 26, 2017

rebuild_merge

@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Oct 26, 2017
@ansibot ansibot merged commit 104934c into ansible:devel Oct 26, 2017
samdoran added a commit that referenced this pull request Oct 26, 2017
* Enable ECHO in prompt module

Fixes #14160

* Set flags to make it possible to edit echoed input as well as hide control charcters

Only do this if a time limit is not set.

* Consolidate settings

(cherry picked from commit 104934c)
@samdoran samdoran moved this from TODO: Nice to have to To be cherrypicked (rc only) in 2.4.x Blocker List Oct 26, 2017
@samdoran samdoran moved this from To be cherrypicked (rc only) to Done in 2.4.2 in 2.4.x Blocker List Oct 26, 2017
@samdoran
Copy link
Contributor Author

Cherrypicked for 2.4.2beta1

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
@samdoran samdoran changed the title Enable ECHO in prompt module Enable ECHO in pause module Mar 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. plugins/action python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
No open projects
2.4.x Blocker List
Done in 2.4.2
Development

Successfully merging this pull request may close these issues.

Pause Prompt keeps input hidden in v2
4 participants