8000 Unexpected behavior resolving collections, if ansible-lint is executed outside project dir · Issue #3957 · ansible/ansible-lint · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Unexpected behavior resolving collections, if ansible-lint is executed outside project dir #3957
Open
@xrow

Description

@xrow
Summary

Issue resolving paths to local collections when ansible-lint is not executed in project dir. It loos like tit will not alter or change the path from collections_path with is ./.

Issue Type
  • Bug Report
OS / ENVIRONMENT
[root@localhost ansible]# ansible-lint --version
ansible-lint 6.22.0 using ansible-core:2.15.6 ansible-compat:4.1.10 ruamel-yaml:None ruamel-yaml-clib:None
A new release of ansible-lint is available: 6.22.0 → 6.22.1 Upgrade by running: pip install --upgrade ansible-lint
  • ansible installation method: pip
  • ansible-lint installation method: pip
STEPS TO REPRODUCE

have a local collection with collections_path = ~/.ansible/collections:/usr/share/ansible/collections:./

[root@localhost infrastructure]# ansible-lint ansible/
WARNING  Listing 4 violation(s) that are fatal
syntax-check[specific]: the role 'xxx.infrastructure.vault' was not found in /scm/infrastructure/ansible/ansible_collections/xxx/infrastructure/playbooks/roles:/root/.cache/ansible-compat/9fec08/roles:/root/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/scm/infrastructure/ansible/ansible_collections/xxx/infrastructure/playbooks
ansible/ansible_collections/xxx/infrastructure/playbooks/local.yml:18:15

syntax-check[missing-file]: Unable to retrieve file contents
ansible/playbooks/add-chart.yml:1:1 Could not find or access '/scm/infrastructure/ansible/playbooks/xxx.infrastructure.local' on the Ansible Controller.

syntax-check[missing-file]: Unable to retrieve file contents
ansible/playbooks/build.yml:1:1 Could not find or access '/scm/infrastructure/ansible/playbooks/xxx.infrastructure.local' on the Ansible Controller.

syntax-check[missing-file]: Unable to retrieve file contents
ansible/playbooks/clean-all.yml:1:1 Could not find or access '/scm/infrastructure/ansible/playbooks/xxx.infrastructure.local' on the Ansible Controller.


                    Rule Violation Summary                     
 count tag                        profile rule associated tags 
     3 syntax-check[missing-file] min     core, unskippable    
     1 syntax-check[specific]     min     core, unskippable    

Failed: 4 failure(s), 0 warning(s) on 43 files.
A new release of ansible-lint is available: 6.22.0 → 6.22.1 Upgrade by running: pip install --upgrade ansible-lint
[root@localhost infrastructure]# ansible-lint -p ansible/
WARNING  Listing 4 violation(s) that are fatal
ansible/ansible_collections/xxx/infrastructure/playbooks/local.yml:18:15: syntax-check[specific]: the role 'xxx.infrastructure.vault' was not found in /scm/infrastructure/ansible/ansible_collections/xxx/infrastructure/playbooks/roles:/root/.cache/ansible-compat/9fec08/roles:/root/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/scm/infrastructure/ansible/ansible_collections/xxx/infrastructure/playbooks
ansible/playbooks/add-chart.yml:1:1: syntax-check[missing-file]: Unable to retrieve file contents
ansible/playbooks/build.yml:1:1: syntax-check[missing-file]: Unable to retrieve file contents
ansible/playbooks/clean-all.yml:1:1: syntax-check[missing-file]: Unable to retrieve file contents

                    Rule Violation Summary                     
 count tag                        profile rule associated tags 
     3 syntax-check[missing-file] min     core, unskippable    
     1 syntax-check[specific]     min     core, unskippable    

Failed: 4 failure(s), 0 warning(s) on 43 files.
A new release of ansible-lint is available: 6.22.0 → 6.22.1 Upgrade by running: pip install --upgrade ansible-lint
[root@localhost infrastructure]# cd ansible/ && ansible-lint .
WARNING  Skipped installing collection dependencies due to running in offline mode.

Passed: 0 failure(s), 0 warning(s) on 5 files. Last profile that met the validation criteria was 'production'.
A new release of ansible-lint is available: 6.22.0 → 6.22.1 Upgrade by running: pip install --upgrade ansible-lint
Desired Behavior

ansible-lint -p ansible/ shall work the same as cd ansible/ && ansible-lint .

Possible security bugs should be reported via email to security@ansible.com

Actual Behavior

See the /scm/infrastructure/ansible missing in the failed run.

[root@localhost ansible]# ansible-lint -p . -vvvv
INFO     Set ANSIBLE_COLLECTIONS_PATH=/root/.cache/ansible-compat/0cb87f/collections:/root/.ansible/collections:/usr/share/ansible/collections:/scm/infrastructure/ansible
[root@localhost infrastructure]# ansible-lint -p ansible/ -vvvv
INFO     Set ANSIBLE_COLLECTIONS_PATH=/root/.cache/ansible-compat/9fec08/collections:/root/.ansible/collections:/usr/share/ansible/collections

Related: ansible/ansible-compat#343

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0