-
Notifications
You must be signed in to change notification settings - Fork 636
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
Make git errors fatal when strict mode is active #3064
Conversation
Hmm... I can't reproduce the original problem using this branch, because the changes made for #2890 stop Git from generating the error I saw originally. Instead I just 'broke' the repo clone so that Git would report errors when running (lint-test-venv) kpfleming@balrog22:~/git-personal/ansible-systemd-networkd$ ansible-lint -v --strict
INFO Set ANSIBLE_LIBRARY=/home/kpfleming/.cache/ansible-compat/988886/modules:/home/kpfleming/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO Set ANSIBLE_COLLECTIONS_PATH=/home/kpfleming/.cache/ansible-compat/988886/collections:/home/kpfleming/.ansible/collections:/usr/share/ansible/collections
INFO Set ANSIBLE_ROLES_PATH=/home/kpfleming/.cache/ansible-compat/988886/roles:/home/kpfleming/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
WARNING Failed to discover lintable files using git: fatal: .git/index: index file open failed: Permission denied
Traceback (most recent call last):
File "/home/kpfleming/git-personal/lint-test-venv/bin/ansible-lint", line 8, in <module>
sys.exit(_run_cli_entrypoint())
^^^^^^^^^^^^^^^^^^^^^
File "/home/kpfleming/git-personal/lint-test-venv/lib/python3.11/site-packages/ansiblelint/__main__.py", line 360, in _run_cli_entrypoint
sys.exit(main(sys.argv))
^^^^^^^^^^^^^^
File "/home/kpfleming/git-personal/lint-test-venv/lib/python3.11/site-packages/ansiblelint/__main__.py", line 250, in main
result = _get_matches(rules, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kpfleming/git-personal/lint-test-venv/lib/python3.11/site-packages/ansiblelint/runner.py", line 216, in _get_matches
lintables = ansiblelint.utils.get_lintables(opts=options, args=options.lintables)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kpfleming/git-personal/lint-test-venv/lib/python3.11/site-packages/ansiblelint/utils.py", line 848, in get_lintables
for filename in discover_lintables(opts):
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kpfleming/git-personal/lint-test-venv/lib/python3.11/site-packages/ansiblelint/file_utils.py", line 420, in discover_lintables
out_present = subprocess.check_output(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python-3.11.2/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/python-3.11.2/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', '-c', 'safe.directory=/home/kpfleming/git-personal/ansible-systemd-networkd', 'ls-files', '--cached', '--others', '--exclude-standard', '-z']' returned non-zero exit status 128. Without |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's sys.exit(1) with a logger error and w/o a traceback
Fixes: #3062