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

ansible-doc get_module_list_text breaks if not on tty #9695

Closed
swsnr opened this issue Dec 2, 2014 · 1 comment · Fixed by #9809
Closed

ansible-doc get_module_list_text breaks if not on tty #9695

swsnr opened this issue Dec 2, 2014 · 1 comment · Fixed by #9809
Labels
bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release

Comments

@swsnr
Copy link

swsnr commented Dec 2, 2014

Issue Type:

Bug Report

Ansible Version:

ansible 1.8.1

Environment:

OS X

Should be independent of the OS, though.

Summary:

ansible-doc --list breaks if stdin is not a tty.

This makes it impossible to obtain a list of all modules within another program, e.g. an online help system for Ansible modules like https://github.com/lunaryorn/ansible-doc.el

Steps To Reproduce:

Run

$ ansible-doc --list < /dev/null
Expected Results:

A list of all ansible modules, just like in ansible-doc --list (without < /dev/null)

Actual Results:

The following traceback:

stty: stdin isn't a terminal
Traceback (most recent call last):
  File "/usr/local/Cellar/ansible/1.8.1/libexec/bin/ansible-doc", line 324, in <module>
    main()
  File "/usr/local/Cellar/ansible/1.8.1/libexec/bin/ansible-doc", line 266, in main
    pager(get_module_list_text(module_list))
  File "/usr/local/Cellar/ansible/1.8.1/libexec/bin/ansible-doc", line 168, in get_module_list_text
    columns = max(60, int(os.popen('stty size', 'r').read().split()[1]))
IndexError: list index out of range
swsnr added a commit to emacsorphanage/ansible-doc that referenced this issue Dec 2, 2014
@abadger abadger added bug_report P2 Priority 2 - Issue Blocks Release and removed P3 labels Dec 2, 2014
mscherer added a commit to mscherer/ansible that referenced this issue Dec 14, 2014
This can be used from another non interactive software, see ansible#9695
for details.
@mscherer
Copy link
Contributor

I have a fix for this problem, but there is now a 2nd issue, it seems that the detection of less fail if /dev/null is used for stdin. I will cook a 2nd commit to fix that.

jimi-c pushed a commit that referenced this issue Feb 17, 2015
This can be used from another non interactive software, see #9695
for details.
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants