1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
Find a file
Ashok Raja R cb3c6417dd pause plugin doesn't flush raw_input prompt
##### Issue Type:

Bugfix Pull Request

##### Ansible Version:

ansible 1.4.3

##### Environment:

N/A

##### Summary:

We are using a wrapper python script to run ansible-playbook. We use subprocess to execute and print the stdout as and when its written. Problem is when we use pause it doesn't display the prompt string as raw_input does not flush stdout before reading from stdin.

It looks like a dirty fix to add "\n" to the prompt string but i don't see any other way to over come this. If anyone else have a better fix please do propose/suggest.

##### Steps To Reproduce:

```yaml
#File: test_play.yml
- name: Test
  hosts: $nodes
  gather_facts: false

  tasks:
    - name: Waiting for User
      local_action: pause prompt="Do you want to continue (yes/no)? "
```

```python
#!/usr/bin/env python
#File: test.py
import shlex, subprocess

def run_process(process):
    process = process.encode("utf-8")
    command = shlex.split(process)
    p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    for line in iter(p.stdout.readline, b''):
        print line,

cmd = "/usr/bin/python -u /usr/bin/ansible-playbook -i hosts.txt test_play.yml -e 'nodes=local'"
run_process(cmd)
```

```
shell $ python test.py
```

##### Expected Results:
```
PLAY [Test] *******************************************************************

TASK: [Waiting for User] ******************************************************
[localhost]
Do you want to continue (yes/no)? :
```

##### Actual Results:
```
PLAY [Test] *******************************************************************

TASK: [Waiting for User] ******************************************************
[localhost]
```
2014-02-28 11:28:38 +05:30
bin Remove breakpoint 2014-02-26 14:53:36 -05:00
docs/man Updated footer date and adding in misc. file generated by earlier doc update 2014-02-12 16:14:41 -06:00
docsite Add vault documentation. 2014-02-27 18:00:02 -05:00
examples Config resoution order correction and documentation. 2014-02-14 14:34:58 -06:00
hacking Remove obsolete module development docs 2014-02-22 15:51:59 +01:00
legacy Various tests using datafiles are being moved into the integration test framework (tests_new right now). 2014-02-20 17:16:58 -05:00
lib/ansible pause plugin doesn't flush raw_input prompt 2014-02-28 11:28:38 +05:30
library add failsafe comment for install_repoquery 2014-02-27 13:42:05 -05:00
packaging Fix spec changelog date again 2014-02-13 10:06:09 -05:00
plugins Save api id to index as an int instead of a list 2014-02-09 16:33:34 +00:00
test Merge pull request #6198 from jlaska/integration_ec2 2014-02-27 10:44:37 -05:00
.gitignore First pass at ec2 module tests 2014-02-26 16:43:30 -05:00
CHANGELOG.md Update changelog for ec2_snapshot 2014-02-26 09:21:22 -05:00
CODING_GUIDELINES.md Update CODING_GUIDELINES.md 2014-02-23 12:22:36 -05:00
CONTRIBUTING.md Update bug reporting instructions to refer to the issue template 2014-02-11 10:26:25 -05:00
COPYING license file should be in source tree 2012-03-15 20:24:22 -04:00
Makefile Revert "Adding a Makefile target for integration tests - "make integration"" 2014-02-26 09:30:16 -06:00
MANIFEST.in Add some docs/examples 2012-08-14 13:05:44 -04:00
README.md Update README.md 2014-02-21 12:58:09 -05:00
RELEASES.txt Updating documentation for release 1.4.5 2014-02-12 15:46:05 -06:00
setup.py Added ansible-vault to the installer 2014-02-21 09:18:49 +01:00
VERSION Version bump for 1.5 2013-11-21 16:33:23 -05:00

PyPI version

Ansible

Ansible is a radically simple configuration-management, application deployment, task-execution, and multinode orchestration engine.

Read the documentation and more at http://ansible.com/

Many users run straight from the development branch (it's generally fine to do so), but you might also wish to consume a release. You can find instructions here for a variety of platforms. If you want a tarball of the last release, go to releases.ansible.com and you can also install with pip.

Design Principles

  • Have a dead simple setup process and a minimal learning curve
  • Be super fast & parallel by default
  • Require no server or client daemons; use existing SSHd
  • Use a language that is both machine and human friendly
  • Focus on security and easy auditability/review/rewriting of content
  • Manage remote machines instantly, without bootstrapping
  • Allow module development in any dynamic language, not just Python
  • Be usable as non-root
  • Be the easiest IT automation system to use, ever.

Get Involved

  • Read Contributing.md for all kinds of ways to contribute to and interact with the project, including mailing list information and how to submit bug reports and code to Ansible.
  • All code submissions are done through pull requests. Take care to make sure no merge commits are in the submission, and use "git rebase" vs "git merge" for this reason. If submitting a large code change (other than modules), it's probably a good idea to join ansible-devel and talk about what you would like to do or add first and to avoid duplicate efforts. This not only helps everyone know what's going on, it also helps save time and effort if we decide some changes are needed.
  • irc.freenode.net: #ansible

Branch Info

  • Releases are named after Van Halen songs.
  • The devel branch corresponds to the release actively under development.
  • Various release-X.Y branches exist for previous releases
  • We'd love to have your contributions, read "CONTRIBUTING.md" for process notes.

Author

Michael DeHaan -- michael@ansible.com

Ansible, Inc