sbaudoin / sonar-ansible

SonarQube plugin to analyze Ansible playbooks
Apache License 2.0
71 stars 17 forks source link

Python error version: 3.9 #40

Open pedrooct opened 3 years ago

pedrooct commented 3 years ago

Following #39 , what python version do you recomend? Using ansible on version 2.9.18 and ansible-lint on version 4.3.7.

imagem

Thank you once again.

pedrooct commented 3 years ago

P.S it only happens when running sonar-scanner.

sbaudoin commented 3 years ago

If this happens, this is certainly because some contextual things differ between the 2 runs, e.g. the Python versions differ or you are running in the venv locally whereas the plugin does not or the modules versions are different. Some environment variables may also differ, leading to different behaviors from Python or ansible-lint. So I'd investigate in this direction: try to identify what makes the runtime environments be different.

BTW, with ansible-lint 4.3.7 I use Ansible 2.8.16 in my integration tests because I was not able to set up a fully functional environment with ansible-lint 2.8.16 and a more recent version of Ansible. However, I had the issue even while running ansible-lint manually, not only via the plugin. I can't exactly remember the error I had, though, but as far as I can remember it came from the version of Python available by default in my Docker containers.

pedrooct commented 3 years ago

Hi. Thank you for the response.

Although i have this error, the sonar-ansible and ansible-lint work as expected so it is just a detail. I will try with diferent ansible versions.

Waiting for 2.5.0! 👍

sbaudoin commented 3 years ago

Hello. I just released version 2.5.0. Tell me if this is OK now or if a new version is required to fix the issue.

pedrooct commented 3 years ago

Thank you so much. I test it today and report if anything happens.

sbaudoin commented 3 years ago

@pedrooct have you noticed any issue? I have to release a 2.5.1 version to fix a code bug so should I also bring anything else in this 2.5.1 release?

pedrooct commented 3 years ago

@pedrooct have you noticed any issue? I have to release a 2.5.1 version to fix a code bug so should I also bring anything else in this 2.5.1 release?

Hi! Sorry for the delay. First, of all the error of this thread on appears with debug set to false. Second the logs show that it didn't find errors on the ansible, but sonarqube later shows the errors.

Sorry, i'm unable to provide screenshots right now.

Thank you.

sbaudoin commented 3 years ago

Hello,

Bad news. Do you have a simple playbook or so that I can use to debug the issue, please?

sbaudoin commented 3 years ago

OK, got it: you face this issue because of #32, which I cannot fix or do not know how to fix. Maybe I can specifically ignore this kind of errors but this would be a very specific behavior, a kind of workaround, so not really to be implemented.

So the only thing you can do is to ignore this issue if that's OK for you. Just confirm me that this is "just" a display error, and that the analysis does not fail.

EDIT: to reproduce the issue I created a playbook that just calls a role whose main.yml has a block that includes another YAML file:

playbook:

---
- hosts: all
  roles:
    - test

roles/test/tasks/main.yml:

---
- block:
    - include: test.yml