Comments (8)
If you have yamllint installed, it will include problems reported by it too. The trick is that yamllint must be installed inside the same python venv as ansible-lint itself. Yamllint is not called directly by the extension, it is called by ansible-lint itself while it is looking at all the files from the repo.
I can assure you that it works as I am using it daily.
What can make this harder to debug is the fact that ansible-lint does silently ignores absence of yamllint. I am almost sure that is what you encounter.
from vscode-ansible.
It looks like ansible-lint is supposed to call yamllint using the YamllintRule, but this doesn't seem to work for me, or at the very least it doesn't pick up my .yamllint
file in my workspace root.
from vscode-ansible.
Well, I can't even make ansible-lint to incorporate yamllint when using ansible-lint
directly on the terminal, so this doesn't seem to be an issue with this extension.
Thank you for your quick reply though!
I will close this issue for now.
from vscode-ansible.
The issue was that we were still using ansible-lint 4.*, which doesn't include the YamllintRule.
But after updating ansible-lint to 5.0.12, I just can't get this extension to work at all.
> ansible-lint --v
ansible-lint 5.0.12 using ansible 2.11.2
ansible-lint works nicely on the console, but the extension is completely non-functional and just doesn't show any error messages. When I downgrade ansible-lint to version 4, it immediately starts working again.
I have absolute no idea how to debug this. It would be nice if this extension could print some errors if something is wrong instead of just failing silently. I am trying for over an hour now.
from vscode-ansible.
The issue is that ansible-lint, when invoked by this extension, doesn't find my ansible installation.
But this can only be seen when debugging this extension and opening the "debug console". For some reason, this error never finds its way into the catch (error)
-block and just gets swallowed. I am not a JavaScript programmer and debugging JS seems to be a nightmare. Whenever i try to step into something to see what happens, suddenly the debugger jumps into a completely unrelated closure.
It's a bummer that the extension doesn't inherit the PATH of the currently active environment. We aren't using Venv, but conda environments instead.
If this extension can only be used by putting symlinks and stuff into the global PATH, there is no way I can make my coworkers use this extension. What a bummer.
from vscode-ansible.
I have a suggestion: Maybe you could allow us to define a custom PATH
as a setting and fall back to process.env
if undefined. Or maybe let us define an additional PATH that will be prepended to the PATH of process.env
...
I got this to work by hacking may own env-parameter into the code in validationProvider.ts
:
var coolenv = { PATH: '/data/ssd/christianc/emsconda/envs/core-platform-ng/bin'}
let options = (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders[0]) ? { cwd: vscode.workspace.workspaceFolders[0].uri.fsPath, env: coolenv } : undefined;
(Again, please keep in mind, I don't know TypeScript or JavaScript at all.).
So, the extension can find the ansible executable now. But now it can't parse a single line that ansible-lint outputs.
Validating /data/ssd/christianc/ansible/core-platform-ng/play.galera-grants.yaml
Failed to recognize linter output line: play.galera-grants.yaml:6: yaml string value is not quoted with single quotes (quoted-strings)
Failed to recognize linter output line: play.galera-grants.yaml:7: yaml string value is not quoted with single quotes (quoted-strings)
Failed to recognize linter output line: play.galera-grants.yaml:9: unnamed-task All tasks should be named
Failed to recognize linter output line: play.galera-grants.yaml:16: yaml string value is not quoted with single quotes (quoted-strings)
Failed to recognize linter output line: play.galera-grants.yaml:17: yaml string value is not quoted with single quotes (quoted-strings)
Failed to recognize linter output line: play.galera-grants.yaml:18: yaml string value is not quoted with single quotes (quoted-strings)
I guess the regex just doesn't match the actual output.
from vscode-ansible.
It works now! The parse issue I've just described happened because I still had parseable: true
in my .ansible-lint
from my previous desperate attempts to debug this issue. After removing this setting, the extension can now parse the output.
So, this just leaves the PATH issue. What do you think about my suggestion to make this configurable? If we could configure the PATH (as suggested, maybe as an addition to the default PATH, but please prepend the configured PATH to the global one) per-workspace, I think that would be a nice solution. Should I open another issue for this? @ssbarnea
from vscode-ansible.
These findings are really useful as they should help us improve it. Configured output in settings should not affect the tool. Still, at this moment we do not even check the version of the linter, but we should, and have a popup msg when we detect a problem.
from vscode-ansible.
Related Issues (20)
- Add document formatting feature OR set YAML extension's formatter on ansible playbooks. HOT 2
- Adopt ansible-language-server into vscode-ansible repository HOT 2
- Suggestions show all installed collections as part of 'ansible.builtin' HOT 1
- Improve Ansible LSP Docs for Vim and Neovim
- RFE: Allow for right-click on a molecule scenario to run it
- chore: upgrade chai v5
- Scaffolding collection fails when the web view in used for subsequent usage
- aaa HOT 1
- ansible variable resolution with live preview HOT 1
- Code quality checklist
- easily follow imports
- Modules from collections are not recognized when COLLECTIONS_PATH is set via env var HOT 1
- Standardise the functionalities provided by ansible-creator in the extension
- Ansible-language-server npm package 1.2.2 is missing core files HOT 1
- RFE: Ability to add devcontainer/devfile files to a workspace w/o ansible-creator
- Update development documentation for the new project structure
- "Open collection" should open in new window, with a new virtual environment
- Disable create buttons in the collection and project creation web-views during the scaffolding process
- Hung up remote session keeps running at 100% CPU HOT 3
- [error] Error: ENOENT: no such file or directory, stat - with temp pyc files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-ansible.