Bug 2213600

Summary: ansible-lint throws trace-back when mistyping file-name
Product: [Fedora] Fedora Reporter: David Juran <djuran>
Component: python-ansible-compatAssignee: chedi toueiti <chedi.toueiti>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 37CC: chedi.toueiti, kevin, maxwell
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-03 06:55:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Juran 2023-06-08 16:45:10 UTC
[david@localhost ansible]$ rpm -q python3-ansible-lin

[david@localhost ansible]$ ansible-lint file_which_does_not_exist
Traceback (most recent call last):
  File "/usr/bin/ansible-lint", line 8, in <module>
    sys.exit(_run_cli_entrypoint())
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansiblelint/__main__.py", line 344, in _run_cli_entrypoint
    sys.exit(main(sys.argv))
             ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansiblelint/__main__.py", line 197, in main
    initialize_options(argv[1:])
  File "/usr/lib/python3.11/site-packages/ansiblelint/__main__.py", line 110, in initialize_options
    options.cache_dir = get_cache_dir(options.project_dir)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ansible_compat/prerun.py", line 13, in get_cache_dir
    basename = project_dir.resolve().name.encode(encoding="utf-8")
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'resolve'


Reproducible:

Comment 1 Parag Nemade 2023-06-10 13:46:12 UTC
This happened due to new update of ansible-compat in F37
The last known ansible-lint build is ansible-lint-6.10.0-1.fc37
which is working fine with python-ansible-compat-2.2.7-9.fc37
but then python-ansible-compat directly got an update to 4.0.4-1.fc37 which broke ansible-lint command.

Comment 2 Parag Nemade 2023-08-03 06:55:08 UTC

*** This bug has been marked as a duplicate of bug 2213747 ***