mschuchard / linter-ansible-linting

ansible-lint linter for pulsar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work anymore on Atom 0.10.0

ludovicc opened this issue · comments

Hello,

I was able to use ansible-linting on Ubuntu 16.04 / Atom 0.8.0, but since an upgrade to Atom 0.10.0 it does not work and returns 'An unexpected error with ansible, ansible-lint, linter-ansible-linting, atom, atom-linter, or your playbook, has occurred'

It seems to be linkefd with a syntax error in ansible-lint, see ansible/ansible-lint#194

Do you mean 1.10.0?

Since I coded that error message to display whenever an unexpected error occurs, I would need the actual playbook to determine the issue.

Yes, I mean 1.10.0

I don't remember exactly which playbook it was, but it should be in that project: https://github.com/LREN-CHUV/mip-microservices-infrastructure or more likely this https://github.com/LREN-CHUV/dev-setup/blob/master/hipster-setup.yml

I don't know which playbook you are referring to in the first link, but the second link produces no output from linter-ansible-linting. It also produces no output from ansible-lint to confirm that linter-ansible-linting is behaving correctly with it.

Tested on Ubuntu 16.04 with Atom 1.10 and ansible-lint 3.2.5.

Could you provide a playbook that you are certain would reproduce the unknown error?

Clarity on unexpected errors improved with b27c0e6. Will close soon on that commit unless further information provided.

An unexpected error with ansible, ansible-lint, linter-ansible-linting, atom, atom-linter, or your playbook, has occurred at line 1 col 1

I get the above error when performing a save.
Tested on Fedora 23 (Atom 1.8.0 & 1.10.2) and Fedora 24 (Atom 1.10.2)

My Fedora 24 box is a fresh install with a newly installed Atom 1.10.2. The only package I have installed is linter-ansible-linting 1.2.0 and it's dependencies language-ansible 0.11.1 and linter 1.11.16

I created a simple playbook test.yaml

---
- hosts: localhost
  connection: local
  vars:
    port: 3214
  tasks:
    - name: 'configure port'
      template:
        src: "templates/proxy.j2"
        dest: "/etc/profile.d/proxy_env.sh"

I can successfully run ansible-lint and yamllint from the command line on the file with no errors. However, after changing the Atom grammar to Ansible on the file (or changing the settings to lint all yaml files) I get the stated error as soon as a save action occurs.
Note that adding actual problems to the file (problems that command-line ansible-lint picks up) are not indicated in as lint issues in Atom. If I mess with the file enough, I can get a syntax error to be reported by creating invalid yaml, but again, this only is picked up on a save; Its as if linting is only occuring on save (I checked the setting on the linter plugin and it is set to "Lint As You Type").

From the Atom console, I see an error being thrown in ~/.atom/packages/linter-ansible-linting/node_modules/sb-exec/lib/index.js:41

spawnedProcess.on('close', function (exitCode) {
  clearTimeout(timeout);
  if (options.stream === 'stdout') {
    if (data.stderr.length && options.throwOnStdErr) {
      reject(new Error(data.stderr.join('').trim()));

With the associated error message:

 Uncaught (in promise) Error: sh: module: line 1: syntax error: unexpected end of file
 sh: error importing function definition for `BASH_FUNC_module'
 sh: scl: line 1: syntax error: unexpected end of file
 sh: error importing function definition for `BASH_FUNC_scl'

This console error seems to be present the moment Atom is launched regardless of if any files are opened.
Hopefully this gives you something to go on, let me know if there's any other information I can provide. Looking forward to using this plugin.

Thanks

@lglussen This issue with Fedora was coincidentally reported and solved on another linter I maintain at AtomLinter/linter-puppet-lint#68. Check that out and see if it helps you.

successful workaround

@mschuchard Thanks for pointing me to that thread. Uninstalling scl-utils and removing the file /usr/share/Modules/init/bash did the trick.

sudo dnf remove scl-utils -y
sudo mv /usr/share/Modules/init/bash ~/Documents/bash.bak
reboot

I tried each on there own, but I only saw results when both steps were applied. I'm happy with this workaround. Hopefully the core issue gets fixed in future releases of environment-modules and scl-utils. Until then, this looks like the way it will have to be on Fedora.

Confirmed working in Fedora 23 & 24

@lglussen Great news. Good thing I maintain several linters so I could remember this came up before.
Anyway, with nothing new from @ludovicc, I am going to go ahead and close this with the resolution of throwing the error to Atom notifications instead of printing a generic error to the linter display.

@mschuchard please close. I'm still getting an error when the playbook is invalid, but I'm waiting that you release an update with better reporting of errors.

How can I configure it to work with atom on a Windows environment? I receive a message to provide the path to the executable but I don't see any executable in the package.