Fix ansible-lint rules tests
ansible-lint does not work when given an empty (/dev/null) config file.
Traceback (most recent call last):
File "/tmp/ansible.td6htcac/bin/ansible-lint", line 8, in <module>
sys.exit(main())
File "/tmp/ansible.td6htcac/lib/python3.6/site-packages/ansiblelint/__main__.py", line 42, in main
options = cli.get_config(sys.argv[1:])
File "/tmp/ansible.td6htcac/lib/python3.6/site-packages/ansiblelint/cli.py", line 208, in get_config
config = load_config(options.config_file)
File "/tmp/ansible.td6htcac/lib/python3.6/site-packages/ansiblelint/cli.py", line 77, in load_config
expand_to_normalized_paths(config, config_dir)
File "/tmp/ansible.td6htcac/lib/python3.6/site-packages/ansiblelint/cli.py", line 40, in expand_to_normalized_paths
if paths_var not in config:
TypeError: argument of type 'NoneType' is not iterable
Change-Id: Id2a883676c9fbb3a2c704c8cbd8f3cbc28cdc5fb
This commit is contained in:
5
test-playbooks/ansible-lint-rules/ansible-lint.yaml
Normal file
5
test-playbooks/ansible-lint-rules/ansible-lint.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
parseable: true
|
||||
quiet: false
|
||||
rulesdir:
|
||||
- ../../.rules/
|
||||
verbosity: 1
|
||||
@@ -1,6 +1,7 @@
|
||||
- hosts: all
|
||||
roles:
|
||||
- ensure-pip
|
||||
- ensure-virtualenv
|
||||
tasks:
|
||||
- name: Create tempdir for ansible-lint venv
|
||||
tempfile:
|
||||
@@ -37,7 +38,8 @@
|
||||
|
||||
- name: Make sure faulty roles fail linting
|
||||
command: >-
|
||||
{{ ansible_lint_tempdir.path }}/bin/ansible-lint -c /dev/null
|
||||
{{ ansible_lint_tempdir.path }}/bin/ansible-lint
|
||||
-c test-playbooks/ansible-lint-rules/ansible-lint.yaml
|
||||
-t {{ item | regex_replace('.*/(ZUULJOBS.*?)/.*', '\1') }}
|
||||
{{ item }}
|
||||
args:
|
||||
@@ -49,6 +51,7 @@
|
||||
- name: Make sure valid roles pass linting
|
||||
command: >-
|
||||
{{ ansible_lint_tempdir.path }}/bin/ansible-lint
|
||||
-c test-playbooks/ansible-lint-rules/ansible-lint.yaml
|
||||
-t {{ item | regex_replace('.*/(ZUULJOBS.*?)/.*', '\1') }}
|
||||
{{ item }}
|
||||
args:
|
||||
|
||||
Reference in New Issue
Block a user