-
SummaryI noticed that a path I added to Issue Type
Ansible and Ansible Lint details$ ansible --version
ansible 2.10.8
$ ansible-lint --version
ansible-lint 5.0.3 using ansible 2.10.8
OS / ENVIRONMENTDocker running Debian 10 image, Python 3.8.5 STEPS TO REPRODUCEI have the following in my exclude_paths:
- roles-vendored/ If I lint a playbook which includes one of these vendored roles, the linter is still trying to lint those files from the vendored role, despite it being in the exclude path. If I pass this option via the command line flag, the behaviour works as expected: ansible-lint --exclude roles-vendored/ Desired BehaviourNo files from the Actual BehaviourFiles inside the excluded path are linted, unless the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hello @Rylon, Do you still experience that issue? If yes, could you please provide a bit more details by passing "-vvv" argument in command line, like that: Thank you in advance |
Beta Was this translation helpful? Give feedback.
-
I am almost sure that the config file is not loaded. It works and we have tests relying on it to work. |
Beta Was this translation helpful? Give feedback.
-
So I'm now encountering this manifestation of this bug:
Setting double verbosity seems to expose a possible reason why. The values from the two sources are not being parsed the same. When passing with the config file only, I get this result:
When passing from the command line, instead, I get this
The values coming from the config file are read as relative to the config file and not relative to the CWD. Personally I would say that this is a bug. Or, at the least, it should be documented that the paths are relative to the config file if they're in the file or to CWD if they're found on the command line. As an additional interesting note, the values read from the file are handled as strings whereas the values pulled from the command line are instances of the class PosixPath. I'm not sure that this means much, but it is worth noting that the file and CLI are not being handled the same. Currently, also, we do prefix string matching. It might be worth considering use of the fnmatch module, instead, so that we can support things like glob paths. Currently, exclude_paths does not have very good support for glob expressions. I can probably work up a PR to at least provide the glob abilities and either fix or document the differences between the CLI and the config_file values for this argument. |
Beta Was this translation helpful? Give feedback.
Hello @Rylon,
Do you still experience that issue? If yes, could you please provide a bit more details by passing "-vvv" argument in command line, like that:
ansible-lint -vvv
Thank you in advance