ansible / vscode-ansible

vscode/vscodium extension for providing Ansible auto-completion and integrating quality assurance tools like ansible-lint, ansible syntax check, yamllint, molecule and ansible-test.
https://ansible.readthedocs.io/projects/vscode-ansible/
MIT License
363 stars 91 forks source link

`invalid syntax` error when saving Ansible files #918

Open jamesholland-uk opened 1 year ago

jamesholland-uk commented 1 year ago

Summary

Error when saving Ansible files. This used to work fine. I have not knowingly changed anything, but given there are so many components involved and so many auto-update themselves, I cannot rule out something updating itself may have caused this. I am unsure if this is a problem with the extension, with ansible itself, or even pyenv.

Error: Screenshot 2023-06-09 at 12 19 08

Command failed: /Users/jholland/.pyenv/versions/3.10.4/bin/python /Users/jholland/.pyenv/shims/ansible-playbook /Users/jholland/code/github/playground/ansible-cloud-deployments/gcp_vmseries_with_config.yml --syntax-check
  File "/Users/jholland/.pyenv/shims/ansible-playbook", line 7
    export PYENV_ROOT="/Users/jholland/.pyenv"
           ^^^^^^^^^^
SyntaxError: invalid syntax

Status Bar:

Screenshot 2023-06-09 at 12 22 04

Extension version

2.3.74

VS Code version

1.79.0 (Universal)

Ansible Version

ansible [core 2.14.3]
  config file = None
  configured module search path = ['/Users/jholland/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/jholland/.pyenv/versions/3.10.4/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/jholland/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/jholland/.pyenv/versions/3.10.4/bin/ansible
  python version = 3.10.4 (main, May 24 2022, 14:08:56) [Clang 13.1.6 (clang-1316.0.21.2.5)] (/Users/jholland/.pyenv/versions/3.10.4/bin/python)
  jinja version = 3.1.2
  libyaml = True

OS / Environment

Mac OS 13.4 (22F66), all files in editor are on the local drive

$ ansible-lint --version
ansible-lint 6.17.0 using ansible-core:2.14.3 ruamel-yaml:0.17.21 ruamel-yaml-clib:0.2.6

Relevant log output

Validating using ansible syntax-check
playbook file
[Info  - 12:20:14] [ansible syntax-check]   File "/Users/jholland/.pyenv/shims/ansible-playbook", line 7
    export PYENV_ROOT="/Users/jholland/.pyenv"
           ^^^^^^^^^^
SyntaxError: invalid syntax
audgirka commented 1 year ago

@priyamsahoo I think this is similar to the one which @ssbarnea has filed for pyenv.

jamesholland-uk commented 1 year ago

Is there any way to fix this, folks? Thanks

priyamsahoo commented 1 year ago

@jamesholland-uk, we are working on this issue, and it will soon be fixed. Thanks for using the extension and raising the bug!

jamesholland-uk commented 1 year ago

Thank you @priyamsahoo. Is there any timeline, or PR I can track, or anything like that? Thank you

dialup4eg commented 11 months ago

ansible [core 2.16.0] config file = None configured module search path = ['/Users/dialup4eg/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /opt/homebrew/Cellar/ansible/9.0.1/libexec/lib/python3.12/site-packages/ansible ansible collection location = /Users/dialup4eg/.ansible/collections:/usr/share/ansible/collections executable location = /opt/homebrew/bin/ansible python version = 3.12.0 (main, Oct 2 2023, 12:03:24) [Clang 15.0.0 (clang-1500.0.40.1)] (/opt/homebrew/Cellar/ansible/9.0.1/libexec/bin/python) jinja version = 3.1.2 libyaml = True

and

ansible-lint 6.22.1 using ansible-core:2.16.0 ansible-compat:4.1.10 ruamel-yaml:0.18.5 ruamel-yaml-clib:0.2.8

the error still persists