sonar-ansible icon indicating copy to clipboard operation
sonar-ansible copied to clipboard

Python error version: 3.9

Open pedrooct opened this issue 3 years ago • 9 comments

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 avatar Aug 23 '21 08:08 pedrooct

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

pedrooct avatar Aug 23 '21 09:08 pedrooct

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.

sbaudoin avatar Aug 24 '21 20:08 sbaudoin

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! 👍

pedrooct avatar Aug 25 '21 07:08 pedrooct

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.

sbaudoin avatar Sep 18 '21 21:09 sbaudoin

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

pedrooct avatar Sep 20 '21 07:09 pedrooct

@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?

sbaudoin avatar Sep 23 '21 21:09 sbaudoin

@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.

pedrooct avatar Sep 24 '21 12:09 pedrooct

Hello,

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

sbaudoin avatar Sep 26 '21 16:09 sbaudoin

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

sbaudoin avatar Sep 26 '21 17:09 sbaudoin