Be consistent about spaces before and after vars

With the arrival of ansible-lint 4, Jinja2 variable expansions must
include spaces before and after the variable name inside the
brackets.

Adjust the new violations accordingly and remove the rule
206 exclusion. For special cases we can have use inline excludes.

Change-Id: Ib3ff7b0233a5d5cf99772f9c2adc81861cf34ffa
This commit is contained in:
Jeremy Stanley 2019-06-26 18:05:08 +00:00 committed by Sorin Sbarnea
parent a0b390936f
commit 6aef14e851
6 changed files with 9 additions and 10 deletions

View File

@ -18,5 +18,5 @@
- name: Fail if we cannot install all packages
fail:
msg: "bindep failed to install from {{ bindep_file}} - {{ bindep_final_check.stdout }}"
msg: "bindep failed to install from {{ bindep_file }} - {{ bindep_final_check.stdout }}"
when: bindep_final_check is failed

View File

@ -1,4 +1,4 @@
- name: Build a tarball and wheel
command: "{{release_python}} setup.py sdist bdist_wheel {{bdist_wheel_xargs}}"
command: "{{ release_python }} setup.py sdist bdist_wheel {{ bdist_wheel_xargs }}"
args:
chdir: "{{ zuul_work_dir }}"

View File

@ -29,7 +29,7 @@
command: >-
ovs-vsctl --may-exist add-port {{ bridge_name }}
{{ bridge_name }}_{{ nodepool_ip }}
-- set interface {{ bridge_name }}_{{ nodepool_ip}}
-- set interface {{ bridge_name }}_{{ nodepool_ip }}
type=vxlan options:remote_ip={{ nodepool_ip }} options:key={{ vni }}
options:local_ip={{ switch_ip }}
delegate_to: "{{ switch }}"

View File

@ -5,7 +5,7 @@
- name: Set up the host ip addresses
set_fact:
ipv4_addresses: >
ipv4_addresses: > # noqa 206
{% set hosts = [] -%}
{% for host, vars in hostvars.items() -%}
{% if vars['nodepool']['private_ipv4'] -%}
@ -16,7 +16,7 @@
{% endif -%}
{% endfor -%}
{{- hosts | sort | unique -}}
ipv6_addresses: >
ipv6_addresses: > # noqa 206
{% set hosts = [] -%}
{% for host, vars in hostvars.items() -%}
{% if vars['nodepool']['public_ipv6'] -%}

View File

@ -18,7 +18,7 @@
- name: Report no wheels to be uploaded
debug:
msg: "Found no wheels to upload: {{found_wheels.msg}}"
msg: "Found no wheels to upload: {{ found_wheels.msg }}"
when: found_wheels.files == []
- name: Register packages on the PyPI server (via wheels)
@ -38,7 +38,7 @@
- name: Report no tarballs to be uploaded
debug:
msg: "Found no tarballs to upload: {{found_tarballs.msg}}"
msg: "Found no tarballs to upload: {{ found_tarballs.msg }}"
when: found_tarballs.files == []
- name: Register packages on the PyPI server (via tarballs)

View File

@ -43,11 +43,10 @@ commands =
# Ansible lint
# [ANSIBLE0012] Commands should not change things if nothing needs doing
# [204] Lines should be no longer than 160 chars
# [206] Variables should have spaces before and after: {{ var_name }}
bash -c "find playbooks -type f -regex '.*.ya?ml' -print0 | \
xargs -t -n1 -0 ansible-lint -xANSIBLE0012,204,206"
xargs -t -n1 -0 ansible-lint -xANSIBLE0012,204"
bash -c 'find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
xargs -t -n1 ansible-lint -xANSIBLE0012,204,206'
xargs -t -n1 ansible-lint -xANSIBLE0012,204'
# Ansible Syntax Check
bash -c "find playbooks -type f -regex '.*.ya?ml' -exec \
ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \{\} + > /dev/null"