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

A semicolon without a space gives unexpected error. #2226

Closed
robertdebock opened this issue Jun 30, 2022 · 1 comment
Closed

A semicolon without a space gives unexpected error. #2226

robertdebock opened this issue Jun 30, 2022 · 1 comment
Labels

Comments

@robertdebock
Copy link
Contributor

Summary

When a key-value pair misses a colon, ansible-lint complains about a further line.

Issue Type
  • Bug Report
Ansible and Ansible Lint details
ansible --version
ansible [core 2.12.2]
  config file = None
  configured module search path = ['/Users/my_user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/my_use/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.9.13 (main, May 24 2022, 21:13:51) [Clang 13.1.6 (clang-1316.0.21.2)]
  jinja version = 3.0.3
  libyaml = True

ansible-lint --version
ansible-lint 6.3.0 using ansible 2.12.2
  • ansible installation method: pip
  • ansible-lint installation method: pip
OS / ENVIRONMENT

Nothing relevant to report.

STEPS TO REPRODUCE

With this playbook:

---
- name: prove issue
  hosts: localhost
  become:no
  # Here `become:no` is missing a space, should be `become: no`.

  tasks:
    - name: sample task
      debug:
        msg: "sample ouput"
Desired Behavior

It would be nice if ansible-lint would report on the faulty line, become:no rather than a later line.

Actual Behavior

ansible-lint throws this warning:

WARNING  Listing 1 violation(s) that are fatal
syntax-check: Ansible syntax check failed.
playbook.yml:1 ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0)

Syntax Error while loading YAML.
  could not find expected ':'

The error appears to be in '/private/tmp/issue/playbook.yml': line 6, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  tasks:
  ^ here
@robertdebock robertdebock added bug new Triage required labels Jun 30, 2022
@ssbarnea ssbarnea removed the new Triage required label Jul 6, 2022
@ssbarnea
Copy link
Member

ssbarnea commented Jul 6, 2022

That is invalid YAML, we cannot load the file. Not a bug.

@ssbarnea ssbarnea closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants