fixed ImportError: cannot import name 'AnsibleLintRule' from 'ansiblelint' #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixed ImportError: cannot import name 'AnsibleLintRule' from 'ansiblelint' (/opt/toolset/lib/python3.8/site-packages/ansiblelint/init.py)
How to reproduce the issue:
Python version 3.8
exclude_paths:
rulesdir:
use_default_rules: true
verbosity: 1
$ ansible-lint . -c .ansible-lint
Error output:
INFO Running ansible-galaxy role install --roles-path /root/.cache/ansible-lint/af766b/roles -vr requirements.yml
WARNING Computed fully qualified role name of myrole1 does not follow current galaxy requirements.
Please edit meta/main.yml and assure we can correctly determine full role name:
galaxy_info:
role_name: my_name # if absent directory name hosting role is used instead
namespace: my_galaxy_namespace # if absent, author is used instead
Namespace: https://galaxy.ansible.com/docs/contributing/namespaces.html#galaxy-namespace-limitations
Role: https://galaxy.ansible.com/docs/contributing/creating_role.html#role-names
As an alternative, you can add 'role-name' to either skip_list or warn_list.
INFO Using /root/.cache/ansible-lint/af766b/roles/myrole1 symlink to current repository in order to enable Ansible to find the role using its expected full name.
INFO Added ANSIBLE_ROLES_PATH=~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/root/.cache/ansible-lint/af766b/roles:/root/.cache/ansible-lint/af766b/roles
Traceback (most recent call last):
File "/opt/toolset/bin/ansible-lint", line 8, in
sys.exit(_run_cli_entrypoint())
File "/opt/toolset/lib/python3.8/site-packages/ansiblelint/main.py", line 299, in _run_cli_entrypoint
sys.exit(main(sys.argv))
File "/opt/toolset/lib/python3.8/site-packages/ansiblelint/main.py", line 214, in main
rules = RulesCollection(options.rulesdirs)
File "/opt/toolset/lib/python3.8/site-packages/ansiblelint/rules/init.py", line 220, in init
for rule in load_plugins(rulesdir):
File "/opt/toolset/lib/python3.8/site-packages/ansiblelint/rules/init.py", line 193, in load_plugins
spec.loader.exec_module(module)
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/ansible-lint-rules/rules/UseTrueFalseInsteadYesNo.py", line 1, in
from ansiblelint import AnsibleLintRule
ImportError: cannot import name 'AnsibleLintRule' from 'ansiblelint' (/opt/toolset/lib/python3.8/site-packages/ansiblelint/init.py)