You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running ansible-lint --version from anywhere but a git repository results in a crash with a stacktrace.
Issue Type
Bug Report
Ansible and Ansible Lint details
Ansible Lint version: 5.1.1 (cannot paste --version output because the program crashes).
ansible-lint installation method: one of pip, OS package
OS / ENVIRONMENT
STEPS TO REPRODUCE
Run ansible-lint --version from the /tmp folder, for example.
$ ansible-lint --versionTraceback (most recent call last): File "/home/tadej/tmp/venv/bin/ansible-lint", line 33, in <module> sys.exit(load_entry_point('ansible-lint', 'console_scripts', 'ansible-lint')()) File "/home/tadej/xlab/ansible/ansible-lint/src/ansiblelint/__main__.py", line 299, in _run_cli_entrypoint sys.exit(main(sys.argv)) File "/home/tadej/xlab/ansible/ansible-lint/src/ansiblelint/__main__.py", line 196, in main initialize_options(argv[1:]) File "/home/tadej/xlab/ansible/ansible-lint/src/ansiblelint/__main__.py", line 83, in initialize_options new_options = cli.get_config(arguments or []) File "/home/tadej/xlab/ansible/ansible-lint/src/ansiblelint/cli.py", line 385, in get_config project_dir = guess_project_dir(options.config_file) File "/home/tadej/xlab/ansible/ansible-lint/src/ansiblelint/file_utils.py", line 273, in guess_project_dir path = result.stdout.splitlines()[0]IndexError: list index out of range
Summary
Running
ansible-lint --version
from anywhere but a git repository results in a crash with a stacktrace.Issue Type
Ansible and Ansible Lint details
Ansible Lint version: 5.1.1 (cannot paste
--version
output because the program crashes).OS / ENVIRONMENT
STEPS TO REPRODUCE
Run
ansible-lint --version
from the/tmp
folder, for example.Desired Behaviour
Ansible Lint should print out its version number.
Additional information
git blame
reported #1661 as the source of the breakage. It was a bit tricky to find the real cause because that one commit contains a bunch of refactoring alongside the actual fix. The error was introduced in https://github.com/ansible-community/ansible-lint/pull/1661/files#diff-4525388e8f05ebb145c2c2366127aba4f3716da965f32a91b70b5c4a0eafd35aL268-L269 because now we do not check the exit code of the git command anymore.Originally reported by Amin.
The text was updated successfully, but these errors were encountered: