Commit Graph

10 Commits (182c6603e77b423bba2dce53bf2994bc4e728542)

Author SHA1 Message Date
WAKAYAMA shirou 56880b76bb fix UnicodeEncode error when using pause module with unicode prompt. 2014-05-22 00:21:14 +09:00
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
Preston Marshall 3ee7b177e8 Allow storing input from user in a pause prompt 2013-09-25 17:28:25 -05:00
Michael DeHaan 8457cf433d Update pause module to not use utils.template 2013-04-12 10:00:20 -04:00
Daniel Hokka Zakrisson ae8d6ac303 Ensure complex_args is considered in all action_plugins 2013-02-28 14:27:42 +01:00
Michael DeHaan 1ecf4a6943 Working on complex argument support. 2013-02-17 15:01:49 -05:00
Michael DeHaan fed82c2188 This implements a basic --check mode which for now is only implemented on template & copy operations. More detail will be shared with the list
shortly.
2013-02-03 20:34:13 -05:00
Jeroen Hoekx f963db6c2a Fix output of pause plugin. 2012-10-29 10:57:13 +01:00
Tim Bielawa 9f6da7b885 Fix variable injection in pause module args. Closes #1209 2012-10-03 23:52:26 -04:00
Tim Bielawa 58a4d2f7b4 Add 'pause' action plugin and support plugins skipping the host loop. 2012-09-25 01:13:35 -04:00