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.

Change-Id: Ib3ff7b0233a5d5cf99772f9c2adc81861cf34ffa
This commit is contained in:
Jeremy Stanley 2019-06-26 18:05:08 +00:00 committed by Sorin Sbarnea
parent 4a1ecf50a5
commit 2711d10186
17 changed files with 39 additions and 40 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

@ -10,7 +10,7 @@
mode: 0400
- name: Obtain ticket for Kerberos
command: "kinit -k -t {{ afs_keytab_tmp.path}} {{ afs.service_name }}"
command: "kinit -k -t {{ afs_keytab_tmp.path }} {{ afs.service_name }}"
- name: Delete AFS keytab tempfile
file:

View File

@ -6,7 +6,7 @@
- name: Parse sphinx build directory
set_fact:
sphinx_dir: "{{sphinx_dir.files | map(attribute='path') | map('regex_replace', '^.*/(.*)$', '\\1') | list}}"
sphinx_dir: "{{ sphinx_dir.files | map(attribute='path') | map('regex_replace', '^.*/(.*)$', '\\1') | list }}"
- name: Process sphinx HTML
when: "'html' in sphinx_dir"

View File

@ -3,11 +3,11 @@
name: receive.denyCurrentBranch ignore
value: ignore
scope: local
repo: "{{ ansible_user_dir }}/{{ item.value.src_dir}}"
repo: "{{ ansible_user_dir }}/{{ item.value.src_dir }}"
with_dict: "{{ zuul.projects }}"
- name: Synchronize src repos to workspace directory
command: "git push {% if mirror_workspace_quiet %}--quiet{% endif %} --mirror git+ssh://{{ ansible_user }}@{{ ansible_host | ipwrap }}:{{ ansible_port }}/{{ ansible_user_dir }}/{{ item.value.src_dir}}"
command: "git push {% if mirror_workspace_quiet %}--quiet{% endif %} --mirror git+ssh://{{ ansible_user }}@{{ ansible_host | ipwrap }}:{{ ansible_port }}/{{ ansible_user_dir }}/{{ item.value.src_dir }}"
args:
chdir: "{{ zuul.executor.work_root }}/{{ item.value.src_dir }}"
with_dict: "{{ zuul.projects }}"

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

@ -9,11 +9,11 @@
- name: Clone cached repo to workspace
shell: |
set -e
git clone --bare {{ cached_repos_root }}/{{ item.0.canonical_name }} {{ ansible_user_dir }}/{{ item.0.src_dir}}/.git
git clone --bare {{ cached_repos_root }}/{{ item.0.canonical_name }} {{ ansible_user_dir }}/{{ item.0.src_dir }}/.git
cd {{ ansible_user_dir }}/{{ item.0.src_dir }}
git config --local --bool core.bare false
args:
creates: "{{ ansible_user_dir }}/{{ item.0.src_dir}}"
creates: "{{ ansible_user_dir }}/{{ item.0.src_dir }}"
when: item.1.stat.exists
with_together:
- "{{ zuul.projects.values() | list }}"
@ -24,9 +24,9 @@
- skip_ansible_lint
- name: Initialize non-cached repos
command: "git init {{ ansible_user_dir }}/{{ item.0.src_dir}}"
command: "git init {{ ansible_user_dir }}/{{ item.0.src_dir }}"
args:
creates: "{{ ansible_user_dir }}/{{ item.0.src_dir}}"
creates: "{{ ansible_user_dir }}/{{ item.0.src_dir }}"
when: not item.1.stat.exists
with_together:
- "{{ zuul.projects.values() | list }}"
@ -43,7 +43,7 @@
git remote -v | grep origin && git remote rm origin || true
git remote add origin file:///dev/null
args:
chdir: "{{ ansible_user_dir }}/{{ item.src_dir}}"
chdir: "{{ ansible_user_dir }}/{{ item.src_dir }}"
with_items: "{{ zuul.projects.values() | list }}"
# ANSIBLE0006: git remote is not supported by ansible module
tags:

View File

@ -2,7 +2,7 @@
command: >-
skopeo --insecure-policy copy
docker://127.0.0.1:{{ socat_port }}/{{ image.repository }}:{{ image_tag }}
docker://{{ intermediate_registry.host | ipwrap }}:{{ intermediate_registry.port}}/{{ image.repository }}:{{ zuul.build }}_{{ image_tag }}
docker://{{ intermediate_registry.host | ipwrap }}:{{ intermediate_registry.port }}/{{ image.repository }}:{{ zuul.build }}_{{ image_tag }}
retries: 3
register: result
until: result is success
@ -16,7 +16,7 @@
zuul:
artifacts:
- name: "image_{{ image.repository }}:{{ image_tag }}"
url: "docker://{{ intermediate_registry.host | ipwrap }}:{{ intermediate_registry.port}}/{{ image.repository }}:{{ zuul.build }}_{{ image_tag}}"
url: "docker://{{ intermediate_registry.host | ipwrap }}:{{ intermediate_registry.port }}/{{ image.repository }}:{{ zuul.build }}_{{ image_tag }}"
metadata:
type: container_image
repository: "{{ image.repository }}"

View File

@ -21,7 +21,7 @@
- name: Ensure Docker registry volume directories exists
file:
state: directory
path: "{{ buildset_registry_root}}/{{ item }}"
path: "{{ buildset_registry_root }}/{{ item }}"
loop:
- certs
- auth
@ -32,23 +32,23 @@
htpasswd:
create: true
crypt_scheme: bcrypt
path: "{{ buildset_registry_root}}/auth/htpasswd"
path: "{{ buildset_registry_root }}/auth/htpasswd"
name: "zuul"
password: "{{ registry_password }}"
- name: Generate a TLS key for the Docker registry
openssl_privatekey:
path: "{{ buildset_registry_root}}/certs/domain.key"
path: "{{ buildset_registry_root }}/certs/domain.key"
- name: Generate a TLS CSR for the Docker registry
openssl_csr:
path: "{{ buildset_registry_root}}/certs/domain.csr"
privatekey_path: "{{ buildset_registry_root}}/certs/domain.key"
path: "{{ buildset_registry_root }}/certs/domain.csr"
privatekey_path: "{{ buildset_registry_root }}/certs/domain.key"
common_name: "{{ ansible_host }}"
subject_alt_name: "DNS:zuul-jobs.buildset-registry,DNS:{{ ansible_host }},IP:{{ ansible_host }},IP:127.0.0.1"
- name: Generate a TLS cert for the Docker registry
openssl_certificate:
path: "{{ buildset_registry_root}}/certs/domain.crt"
csr_path: "{{ buildset_registry_root}}/certs/domain.csr"
privatekey_path: "{{ buildset_registry_root}}/certs/domain.key"
path: "{{ buildset_registry_root }}/certs/domain.crt"
csr_path: "{{ buildset_registry_root }}/certs/domain.csr"
privatekey_path: "{{ buildset_registry_root }}/certs/domain.key"
provider: selfsigned
register: generated_cert
- name: Read TLS certificate
@ -73,8 +73,8 @@
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
volumes:
- "{{ buildset_registry_root}}/certs:/certs"
- "{{ buildset_registry_root}}/auth:/auth"
- "{{ buildset_registry_root }}/certs:/certs"
- "{{ buildset_registry_root }}/auth:/auth"
- name: Start a docker proxy
docker_container:
name: buildset_proxy
@ -93,8 +93,8 @@
REGISTRY_PROXY_USERNAME: ''
REGISTRY_PROXY_PASSWORD: ''
volumes:
- "{{ buildset_registry_root}}/certs:/certs"
- "{{ buildset_registry_root}}/auth:/auth"
- "{{ buildset_registry_root }}/certs:/certs"
- "{{ buildset_registry_root }}/auth:/auth"
- name: Set registry information fact
set_fact:
buildset_registry:

View File

@ -59,7 +59,7 @@
- name: Copy files and folders to staging folder
# remote_src copy does not work recursively, synchronise is restricted by
# zuul, using command
command: cp -pRL {{ item.source}} {{ stage_dir }}/{{ item.dest }}
command: cp -pRL {{ item.source }} {{ stage_dir }}/{{ item.dest }}
become: true
with_items: "{{ all_sources }}"

View File

@ -3,11 +3,11 @@
name: receive.denyCurrentBranch ignore
value: ignore
scope: local
repo: "{{ ansible_user_dir }}/{{ item.value.src_dir}}"
repo: "{{ ansible_user_dir }}/{{ item.value.src_dir }}"
with_dict: "{{ zuul.projects }}"
- name: Synchronize src repos to workspace directory
command: "git push --mirror git+ssh://{{ ansible_user }}@{{ ansible_host | ipwrap }}:{{ ansible_port }}/{{ ansible_user_dir }}/{{ item.value.src_dir}}"
command: "git push --mirror git+ssh://{{ ansible_user }}@{{ ansible_host | ipwrap }}:{{ ansible_port }}/{{ ansible_user_dir }}/{{ item.value.src_dir }}"
args:
chdir: "{{ zuul.executor.work_root }}/{{ item.value.src_dir }}"
with_dict: "{{ zuul.projects }}"

View File

@ -27,7 +27,7 @@
indexes: "{{ zuul_log_create_indexes }}"
files:
- "{{ zuul.executor.log_root }}/"
delete_after: "{{zuul_log_delete_after | default(omit) }}"
delete_after: "{{ zuul_log_delete_after | default(omit) }}"
register: upload_results
- name: Return log URL to Zuul

View File

@ -9,7 +9,7 @@
- name: Create log directories
file:
path: "{{zuul_logserver_root}}/{{ zuul_log_path }}"
path: "{{ zuul_logserver_root }}/{{ zuul_log_path }}"
state: directory
recurse: yes
mode: 0775
@ -26,7 +26,7 @@
- name: Upload logs to log server
synchronize:
src: "{{ zuul.executor.log_root }}/"
dest: "{{zuul_logserver_root}}/{{ zuul_log_path }}/"
dest: "{{ zuul_logserver_root }}/{{ zuul_log_path }}/"
rsync_opts:
- "--exclude=job-output.txt"
- "--exclude=job-output.json"
@ -44,7 +44,7 @@
- name: Upload console log and json output
synchronize:
src: "{{ zuul.executor.log_root }}/{{ item }}.gz"
dest: "{{zuul_logserver_root}}/{{ zuul_log_path }}/{{ item }}.gz"
dest: "{{ zuul_logserver_root }}/{{ zuul_log_path }}/{{ item }}.gz"
verify_host: true
with_items:
- job-output.txt

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

@ -66,7 +66,7 @@
- name: Add registry to docker daemon configuration
vars:
new_config:
registry-mirrors: "['https://{{ buildset_registry_alias }}:{{ buildset_registry.port}}/', 'https://{{ buildset_registry_alias }}:{{ buildset_registry.proxy_port}}/']"
registry-mirrors: "['https://{{ buildset_registry_alias }}:{{ buildset_registry.port }}/', 'https://{{ buildset_registry_alias }}:{{ buildset_registry.proxy_port }}/']"
set_fact:
docker_config: "{{ docker_config | combine(new_config) }}"
- name: Save docker daemon configuration

View File

@ -15,7 +15,7 @@ zuul
ansible>=2.5.1,<2.6 # https://review.openstack.org/567007
# Don't automatically switch to ansible-lint 5 when it becomes
# available, so that it can be evaluated for an orderly transition.
ansible-lint<5
ansible-lint>=4.1.1a0,<5
bashate>=0.2
stestr>=1.0.0 # Apache-2.0
# For upload-logs-swift:

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"