molecule: yamllint is not found when running 'lint' target as of Molecule 3.0.7
Issue Type
- Bug report
Molecule and Ansible details
Ansible 2.9.12
Molecule 3.0.7
Molecule installation method (one of):
- pip
Ansible installation method (one of):
- pip
Detail any linters or test runners used:
yamllint and ansible-lint, test is run in Travis CI environment
Desired Behavior
Linters should run without issue.
Actual Behaviour
--> Scenario: 'default'
--> Action: 'lint'
--> Executing: set -e
yamllint .
ansible-lint
/bin/sh: 2: yamllint: not found
ERROR: Lint failed: Command 'set -e
yamllint .
ansible-lint
' returned non-zero exit status 127.: Command 'set -e
yamllint .
ansible-lint
' returned non-zero exit status 127.
See failed build: https://travis-ci.org/github/geerlingguy/ansible-role-clamav/jobs/718754330#L470
It looks like this bug was introduced in the 3.0.7 release. If I pip install molecule===3.0.6
the problem goes away.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 8
- Comments: 16 (10 by maintainers)
Commits related to this issue
- Use molecule 3.0.6 until #2781 is resolved. Issue #2781 causes CI to fail with an "ansible-lint" or 'yamllint' not found error if molecule 3.0.7 is used. (https://github.com/ansible-community/molecul... — committed to chzerv/ansible-role-sysctl by chzerv 4 years ago
- Pin molecule version for 3.0.7 test failures: https://github.com/ansible-community/molecule/issues/2781 — committed to matburt/awx-operator by matburt 4 years ago
- #53 Disallow molecule 3.0.7 due to the https://github.com/ansible-community/molecule/issues/2781 — committed to lemberg/draft-environment by T2L 4 years ago
- add temp fix https://github.com/ansible-community/molecule/issues/2781#issuecomment-675597145 — committed to darkwizard242/ansible-role-awless by darkwizard242 4 years ago
- Passing env to lint calls was suppressing PATH Addresses #2781 by passing os.environ through to the value of the lint command and supplementing with the MOLECULE environment variables — committed to greg-hellings/molecule by greg-hellings 4 years ago
- Implement workaround for 2781 molecule issue This workaround was suggested here[1]. It'll be removed in future releases [1] https://github.com/ansible-community/molecule/issues/2781#issuecomment-675... — committed to electrocucaracha/krd by electrocucaracha 4 years ago
- Assure env is passted to lint calls (#2783) Addresses #2781 by passing os.environ through to the value of the lint command and supplementing with the MOLECULE environment variables — committed to ansible/molecule by greg-hellings 4 years ago
- Implement workaround for 2781 molecule issue This workaround was suggested here[1]. It'll be removed in future releases [1] https://github.com/ansible-community/molecule/issues/2781#issuecomment-675... — committed to electrocucaracha/krd by electrocucaracha 4 years ago
- Implement workaround for 2781 molecule issue This workaround was suggested here[1]. It'll be removed in future releases [1] https://github.com/ansible-community/molecule/issues/2781#issuecomment-675... — committed to electrocucaracha/krd by electrocucaracha 4 years ago
- workaround for ansible-community/molecule#2781 — committed to hurricanehrndz/ansible-pyenv by deleted user 4 years ago
- Workaround for ansible-community/molecule#2781 Molecule 3.0.7 performs lint without variables from invoking environment. PATH variable from invoking environment temporarily pass to lint step. — committed to hurricanehrndz/ansible-yubikey by deleted user 4 years ago
- Fix yamllint tox errors yamllint missing in $PATH causes molecule tests to fail. Ref: https://github.com/ansible-community/molecule/issues/2781 Change-Id: I56239b893cac2aeeb364ab41b70d98126a057637 S... — committed to lfit/ansible-roles-lf-recommended-tools by askb 3 years ago
- try this https://github.com/ansible-community/molecule/issues/2781#issuecomment-675597145 — committed to pwalczysko/prod-playbooks by pwalczysko a year ago
OK, here’s what’s going on:
I have yamllint installed through Fedora package manager. So without passing the PATH value through to the environment my system is picking up /usr/bin/yamllint. When I send through the PATH value, I get the yamllint that’s installed in my virtualenv.
Since the previous behavior of molecule was to run with the entire invoking environment, I’m going to submit a patch that passes the entirety of os.environ through along with the MOLECULE_ values unless someone objects to that.
For a quick-and-dirty workaround while waiting for the next release, add the following
PATH=
line in thelint
block, before running the linters:The PATH variable will be expanded by molecule BEFORE running the shell script, instead of being expanded by the shell of the
lint
block.