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 lint is missing in the environment" despite being installed in the OS #1522

Closed
C0rn3j opened this issue Aug 30, 2024 · 1 comment
Closed
Labels
bug Something isn't working new

Comments

@C0rn3j
Copy link

C0rn3j commented Aug 30, 2024

Summary

As I wrote up this issue I ended up thinking it's an upstream one in ansible-lint for which I could not find a report there either. Putting it here for visibility at least, will close if it I find enough time to verify and report upstream.

It fails the same way even executing it in my home (project folder executes fine):

[0] % ansible-lint
Traceback (most recent call last):
  File "/usr/bin/ansible-lint", line 8, in <module>
    sys.exit(_run_cli_entrypoint())
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/__main__.py", line 408, in _run_cli_entrypoint
    sys.exit(main(sys.argv))
             ^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/__main__.py", line 290, in main
    cache_dir_lock = initialize_options(argv[1:])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/__main__.py", line 125, in initialize_options
    new_options = cli.get_config(arguments or [])
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/cli.py", line 606, in get_config
    project_dir, method = find_project_root(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/file_utils.py", line 526, in find_project_root
    if resolved_cfg_path.is_file():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 892, in is_file
    return S_ISREG(self.stat().st_mode)
                   ^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 840, in stat
    return os.stat(self, follow_symlinks=follow_symlinks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/.config/ansible-lint.yml'

image

[0] % pacman -Q ansible-core ansible-lint
ansible-core 2.17.3-1
ansible-lint 24.7.0-1

[0] % command -v ansible-lint  
/usr/bin/ansible-lint

VSC:

Version: 1.92.1
Commit: eaa41d57266683296de7d118f574d0c2652e1fc4
Date: 2024-08-09T07:48:41.621Z
Electron: 30.4.0
ElectronBuildId: undefined
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Linux x64 6.10.6-arch1-1

Extension version

v24.8.4

VS Code version

1.19.2

Ansible Version

[130] % ansible --version
# Not much I can do about this warning at the moment - https://github.com/nextcloud/desktop/issues/6863
[WARNING]: Ansible is being run in a world writable directory (/home/c0rn3j/Nextcloud/HugeFiles/Projects/configs), ignoring it as an ansible.cfg source. For more information see https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
ansible [core 2.17.3]
  config file = None
  configured module search path = ['/home/c0rn3j/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /home/c0rn3j/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.5 (main, Aug  9 2024, 08:20:41) [GCC 14.2.1 20240805] (/usr/bin/python)
  jinja version = 3.1.4
  libyaml = True

OS / Environment

Arch Linux, OS packages.

Relevant log output

Path for lint: /usr/bin/ansible-lint
Validating using ansible-lint
cmd 'ansible-lint --version' was not executed with the following error: ' Command failed: /usr/bin/ansible-lint --version
Traceback (most recent call last):
  File "/usr/bin/ansible-lint", line 8, in <module>
    sys.exit(_run_cli_entrypoint())
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/__main__.py", line 408, in _run_cli_entrypoint
    sys.exit(main(sys.argv))
             ^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/__main__.py", line 290, in main
    cache_dir_lock = initialize_options(argv[1:])
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/__main__.py", line 125, in initialize_options
    new_options = cli.get_config(arguments or [])
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/cli.py", line 606, in get_config
    project_dir, method = find_project_root(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/ansiblelint/file_utils.py", line 526, in find_project_root
    if resolved_cfg_path.is_file():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 892, in is_file
    return S_ISREG(self.stat().st_mode)
                   ^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 840, in stat
    return os.stat(self, follow_symlinks=follow_symlinks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/.config/ansible-lint.yml'
@C0rn3j
Copy link
Author

C0rn3j commented Aug 30, 2024

Yeah, that was an upstream issue, workaround in the upstream report at ansible/ansible-lint#4306

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new
Projects
Archived in project
Development

No branches or pull requests

1 participant