8000 Custom ansible root dir breaks requirements resolution · Issue #3863 · ansible/ansible-lint · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Custom ansible root dir breaks requirements resolution #3863
Open
@szaffarano

Description

@szaffarano
Summary

I'm using ansible-lint as part of my pre-commit hooks. Today I bumped the hooks versions (i.e. pre-commit autoupdate) and ansible-lint started to fail.

  • Pre commit config:
  - repo: https://github.com/ansible/ansible-lint
    rev: v6.21.1
    hooks:
      - id: ansible-lint
        args: [--project-dir=ansible]

Project structure

.
├── ansible
│   ├── ansible.cfg
│   ├── hosts.ini
│   ├── host_vars
│   ├── README.md
│   ├── requirements.yml
│   ├── roles
│   ├── .ansible-lint
│   └── vars
├── .pre-commit-config.yaml
└── ...

The previous version was v6.15.0 and it worked fine, but with v6.21.1 it started failing because it doesn't download the roles and collections listed in ansible/requirements.yml.

As a workaround, if I move requirements.yml to the project root directory, it works. But as I said, it was working as expected with previous versions. It seems that --project-dir=ansible is not working anymore, but on the other side, setting any value makes ansible-lint fail with the proper error message: Failed to determine a valid project_dir.

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
v6.21.1
  • ansible installation method: one of source, pip, OS package
  • ansible-lint installation method: one of source, pip, OS package
STEPS TO REPRODUCE

Use the above pre-commit configuration in any ansible project located in a subfolder, depending on any collection or role.

Desired Behavior

Honor the --project-dir flag to use this value as the ansible project root directory.

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

Actual Behavior

Please give some details of what is happening.
Include a minimum complete verifiable example with:

  • minimized playbook to reproduce the error
  • the output of running ansible-lint including the command line used
  • if you're getting a stack trace, also the output of
    ansible-playbook --syntax-check playbook

Related: ansible/ansible-compat#343

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0