ansible-review
ansible-review copied to clipboard
same_variables_defined_in_competing_groups fails with Ansible 2.4
When this rule runs on an inventory file, it fails with the following traceback:
Traceback (most recent call last):
File "/home/pmacarth/.local/bin/ansible-review", line 11, in <module>
load_entry_point('ansible-review==0.13.4', 'console_scripts', 'ansible-review')()
File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/__main__.py", line 95, in main
errors = errors + candidate.review(options, lines)
File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/__init__.py", line 76, in review
return utils.review(self, settings, lines)
File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/utils/__init__.py", line 120, in review
result = standard.check(candidate, settings)
File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/groupvars.py", line 56, in same_variable_defined_in_competing_groups
var_manager = ansible.vars.VariableManager()
AttributeError: 'module' object has no attribute 'VariableManager'
Fixing this to import from ansible.vars.manager
only makes it fail with another traceback:
Traceback (most recent call last):
File "/home/pmacarth/.local/bin/ansible-review", line 11, in <module>
load_entry_point('ansible-review==0.13.4', 'console_scripts', 'ansible-review')()
File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/__main__.py", line 95, in main
errors = errors + candidate.review(options, lines)
File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/__init__.py", line 76, in review
return utils.review(self, settings, lines)
File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/utils/__init__.py", line 120, in review
result = standard.check(candidate, settings)
File "/home/pmacarth/.local/lib/python2.7/site-packages/ansiblereview/groupvars.py", line 61, in same_variable_defined_in_competing_groups
inv = _inv or ansible.inventory.Inventory(loader=loader,
AttributeError: 'module' object has no attribute 'Inventory'
This would appear to be due to the overhaul in ansible/ansible#23001, so the corresponding code here should be adjusted to allow it to work with Ansible 2.4.
You are indeed quite right, but 'should be adjusted' understates things somewhat as it's really 'should be rewritten almost entirely from scratch'. I have the same problem with ansible-inventory-grapher, I know I need to fix them both, but I haven't yet found the time to do so. Soon I hope though.