You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a path in PATH ends with a trailing slash (which is correct) (eg. /app/bin/), but
ansible-lint looked for a string without the trailing slash, as returned by str(parent) (eg. /app/bin),
which resulted in adding the unnecessary path to PATH and printing a warning (example PATH could contain something like /app/bin/:/app/bin)
Comparing Path objects instead of strings would solve the problem.
For reference - I created a PR (but couldn't get the checks to work): #4210
Issue Type
Bug Report
OS / ENVIRONMENT
not relevant
STEPS TO REPRODUCE
Prerequisite: have ansible installed in /app/bin/ansible and ansible-lint in /app/bin/ansible-lint
Desired Behavior
> PATH=/app/bin/ ansible-lint
[...] # no warning
> PATH=/app/bin ansible-lint
[...] # no warning
Actual Behavior
> PATH=/app/bin/ ansible-lint
WARNING: PATH altered to include /app/bin :: This is usually a sign of broken local setup, which can cause unexpected behaviors.
[...]
> PATH=/app/bin ansible-lint
[...] # no warning
The text was updated successfully, but these errors were encountered:
Summary
There's an issue that causes printing an unnecessary warning and unnecessary injection of a certain path to PATH environmental variable.
https://github.com/ansible/ansible-lint/blob/main/src/ansiblelint/__main__.py#L464
if (parent / "ansible").exists() and str(parent) not in paths
Personally I encountered a case when:
PATH
ends with a trailing slash (which is correct) (eg./app/bin/
), butstr(parent)
(eg./app/bin
),PATH
and printing a warning (examplePATH
could contain something like/app/bin/:/app/bin
)Comparing Path objects instead of strings would solve the problem.
For reference - I created a PR (but couldn't get the checks to work): #4210
Issue Type
OS / ENVIRONMENT
not relevant
STEPS TO REPRODUCE
Prerequisite: have
ansible
installed in/app/bin/ansible
andansible-lint
in/app/bin/ansible-lint
Desired Behavior
Actual Behavior
The text was updated successfully, but these errors were encountered: