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

5.0.3 fails when git binary is not available #1455

Closed
sio opened this issue Mar 11, 2021 · 0 comments · Fixed by #1456
Closed

5.0.3 fails when git binary is not available #1455

sio opened this issue Mar 11, 2021 · 0 comments · Fixed by #1456
Labels

Comments

@sio
Copy link

sio commented Mar 11, 2021

Summary

Ansible-lint fails if git binary is not present on the machine. This is new behavior in 5.0.3, 5.0.2 was working fine.

Issue Type
  • Bug Report
Ansible and Ansible Lint details
ansible 2.10.6
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /builds/sio/server_common/venv/lib/python3.7/site-packages/ansible
  executable location = /builds/sio/server_common/venv/bin/ansible
  python version = 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]

ansible-lint-5.0.3
  • ansible installation method: pip
  • ansible-lint installation method: pip
OS / ENVIRONMENT

Docker container based on debian:10-slim

STEPS TO REPRODUCE

Execute ansible-lint on a system where git is not installed.

Desired Behaviour

Ansible-lint works fine, except for the features that require VCS awareness like --progressive

Actual Behaviour

Ansible-lint throws an exception when it fails to locate git:

ansible-lint --exclude molecule -x yaml
Traceback (most recent call last):
  File "/builds/sio/server_common/venv/bin/ansible-lint", line 8, in <module>
    sys.exit(_run_cli_entrypoint())
  File "/builds/sio/server_common/venv/lib/python3.7/site-packages/ansiblelint/__main__.py", line 268, in _run_cli_entrypoint
    sys.exit(main(sys.argv))
  File "/builds/sio/server_common/venv/lib/python3.7/site-packages/ansiblelint/__main__.py", line 169, in main
    initialize_options(argv[1:])
  File "/builds/sio/server_common/venv/lib/python3.7/site-packages/ansiblelint/__main__.py", line 75, in initialize_options
    new_options = cli.get_config(arguments)
  File "/builds/sio/server_common/venv/lib/python3.7/site-packages/ansiblelint/cli.py", line 377, in get_config
    options.config_file or f"{guess_project_dir()}/.ansiblelint"
  File "/builds/sio/server_common/venv/lib/python3.7/site-packages/ansiblelint/file_utils.py", line 226, in guess_project_dir
    check=False,
  File "/usr/lib/python3.7/subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'git': 'git'

Full log here: https://gitlab.com/sio/server_common/-/jobs/1088829855#L327

@sio sio added the bug label Mar 11, 2021
ssbarnea added a commit that referenced this issue Mar 11, 2021
Avoids an exception when trying to determine project root directory
and git is missing and there is no .ansible-lint config either.

Fixes: #1455
ssbarnea added a commit that referenced this issue Mar 11, 2021
Avoids an exception when trying to determine project root directory
and git is missing and there is no .ansible-lint config either.

Fixes: #1455
j-e-libre-logic added a commit to libre-logic/ansible-collection-librelogic that referenced this issue Mar 26, 2021
- ansible/ansible-lint#1455 (5.0.3 fails when git binary is not available)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant