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

Add stdin ("-") to the command-line arguments of ansible-lint >=5.0.0 #3786

Merged
merged 2 commits into from
Jul 5, 2021
Merged

Add stdin ("-") to the command-line arguments of ansible-lint >=5.0.0 #3786

merged 2 commits into from
Jul 5, 2021

Conversation

jamescherti
Copy link
Contributor

@jamescherti jamescherti commented Jun 27, 2021

Ansible-lint version >=5.0.0 ignores the standard input when "-" or "/dev/stdin" is not explicitly specified in the arguments:

:ALEInfo
(finished - exit code 0) ['/bin/bash', '-c', ''ansible-lint'' --parseable-severity -x yaml < ''/tmp/vVyvn4B/7/test2.yml'']
<<<NO OUTPUT RETURNED>>>'

This commit adds "-" to the arguments of ansible-lint version >=5.0.0 (file: ale_linters/ansible/ansible_lint.vim).

Steps to reproduce the bug:

Tested with: ansible-lint 5.0.12 using ansible 2.11.2

Create the file "test.yml":

- hosts: localhost
  gather_facts: no
  tasks:
    - name: "Shell test"
      shell: "ls /"

Execute "ansible-lint" without "-" (result: no output):

$ ansible-lint --parseable-severity -x yaml < test.yml

Execute "ansible-lint" with "-" (result: the errors are displayed):

$ ansible-lint --parseable-severity -x yaml - < test.yml
WARNING  Listing 1 violation(s) that are fatal
stdin:1: [internal-error] [VERY_HIGH] Unexpected error code 1 from execution of: ansible-playbook --syntax-check /tmp/tmp939mrvbkplaybook.yml
You can skip specific rules or tags by adding them to your configuration file:
# .ansible-lint
warn_list:  # or 'skip_list' to silence them completely
  - internal-error  # Unexpected internal error

Finished with 1 failure(s), 0 warning(s) on 1 files.

…t.vim).

This commit fixes the issue "<<NO OUTPUT RETURNED>>":
```
:ALEInfo
(finished - exit code 0) ['/bin/bash', '-c', ''ansible-lint'' --parseable-severity -x yaml < ''/tmp/vVyvn4B/7/test2.yml'']
<<<NO OUTPUT RETURNED>>>'
```

Reason: Ansible-lint ignores stdin when "-" or "/dev/stdin" is not
specified explicitly.

Tested with: ansible-lint 5.0.12 using ansible 2.11.2
@jamescherti jamescherti changed the title Added an explicit stdin argument to ansible-lint >=5.0.0 Added an explicit stdin argument to ansible_lint.vim (ansible-lint >=5.0.0) Jun 27, 2021
@jamescherti jamescherti changed the title Added an explicit stdin argument to ansible_lint.vim (ansible-lint >=5.0.0) Add stdin ("-") to the command-line arguments of ansible-lint >=5.0.0 Jun 27, 2021
maxwell-k
maxwell-k previously approved these changes Jun 29, 2021
Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

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

Tests need to be updated too.

@jamescherti
Copy link
Contributor Author

@hsanson @maxwell-k I have updated the tests.

Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

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

Thanks for the changes.

@hsanson hsanson merged commit af13c35 into dense-analysis:master Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants