debops / ansible-apache

Manage and configure the Apache HTTP Server
GNU General Public License v3.0
2 stars 6 forks source link

Role affected by Ansible bug #20494 #18

Open scibi opened 7 years ago

scibi commented 7 years ago

I tried using this role but unfortunately it was failing like that:

TASK [debops.apache : Create conf-available snippets] **************************
failed: [XXX] (item={'value': True, 'key': u'local-debops_apache'}) => {"failed": true, "item": {"key": "local-debops_apache", "value": true}, "msg": "KeyError: 'undefined variable: 0'"}

I tried to debug it but I couldn't find any reason for this behavior. Then I found ansible/ansible#20494. And it looks like this role is affected.

I'm using:

ansible==2.1.5.0
Jinja2==2.9.5

Everything seems to work after downgrading Jinja to 2.8.1.

ypid commented 7 years ago

Thanks for reporting. Using Jinja 2.8.1 seems to be the current workaround. Have you tried to remove one of the imports from the effected template to confirm that this is related to the issue you posted? The role only uses Jinja imports.

ypid commented 7 years ago

Ping @scibi

scibi commented 7 years ago

Hi!

I'm sorry. I didn't make such test. I've just downgraded and didn't investigate further.

scibi commented 6 years ago

Hi @ypid !

I'm back with the same bug ;) This time I'm using current code from debops repo and:

ansible==2.4.2.0
debops==0.6.1
Jinja2==2.10

Role fails with following error:

TASK [debops.apache : Create conf-available snippets] *************************************************************************************************************************************************************
 [WARNING]: Unable to find 'lookup/ferm__fix_dependent_rules.j2' in expected paths.

failed: [XXX] (item={'key': u'local-debops_apache', 'value': True}) => {"changed": false, "failed": true, "item": {"key": "local-debops_apache", "value": true}, "msg": "AnsibleError: {{ lookup(\"template\", \"lookup/ferm__fix_dependent_rules.j2\", convert_data=False) | from_json }}: An unhandled exception occurred while running the lookup plugin 'template'. Error was a <class 'ansible.errors.AnsibleError'>, original message: the template file lookup/ferm__fix_dependent_rules.j2 could not be found for the lookup"}

Removing one import statement helps. Downgrading Jinja2 to 2.8.1 sovles the issue too. That's weird because ansible/ansible#20494 was fixed in 2.4...

drybjed commented 6 years ago

The same error with the same issue about not finding lookup/ferm__fix_dependent_rules.j2 shows up in debops.nginx role as well, when Jinja >2.8 is installed.

I can see in the template file that the apache__tpl_macros.j2 file is imported two times, this entry is there from the start. Probably a misspelling... If @scibi reports that removing one helps with the bug, I'll remove one of the import statements in the monorepo version of the role right away.

I wonder what's the solution for debops.nginx error. Maybe something related to extends?

Edit: Ah, scratch that - these are different files. But one also imports the other, so it seems that debops__tpl_macros.j2 is effectively imported two times?

jwaibel commented 6 years ago

i could resove this issue by uninstalling the pip version of jinya2 and use the debian package instead. This installed jinya2 (2.8.1) and the problem with nginx been gone for me.