Unquote empty braces inside jinja blocks

Quoting empty braces inside jinja blocks (i.e. {{ '{}' }}) tells jinja to treat
the braces as a string instead of as an empty dict. Since these occur in jinja
blocks, the yaml processor has already interpretted them as strings, and there is
no threat of the yaml processor interpretting the braces as a yaml object.

As-is, the quoted strings cause errors such as:
  FAILED! => {"failed": true, "msg": "|combine expects dictionaries, got '{}'"}

Change-Id: I4f859d8e3b9eff7ce962d7690c1ceea3e6229fe5
This commit is contained in:
K Jonathan Harker 2017-10-26 15:56:13 -07:00
parent 580ec8969b
commit f52ca4e8b5
7 changed files with 17 additions and 17 deletions

View File

@ -120,11 +120,11 @@
dib_arglist: "{{dib_trace_arg|default('')}} {{dib_uncompressed_arg|default('')}} {{dib_clearenv_arg|default('')}} {{dib_notmpfs_arg|default('')}} {{dib_offline_arg|default('')}} {{dib_skipbase_arg|default('')}} {{dib_arch_arg|default('')}} {{dib_imagename_arg|default('')}} {{dib_imagetype_arg|default('')}} {{dib_imagesize_arg|default('')}} {{dib_imagecache_arg|default('')}} {{dib_maxresize_arg|default('')}} {{dib_mintmpfs_arg|default('')}} {{dib_mkfsopts_arg|default('')}} {{dib_qemuopts_arg|default('')}} {{dib_rootlabel_arg|default('')}} {{dib_rdelement_arg|default('')}} {{dib_installtype_arg|default('')}} {{dib_packages_arg|default('')}} {{dib_os_element}} {{dib_elements|default('')}}"
- name: "Initiate image build"
command: disk-image-create {{dib_arglist}}
environment: "{{ dib_env_vars_final | combine(bifrost_venv_env if enable_venv|bool else '{}') }}"
environment: "{{ dib_env_vars_final | combine(bifrost_venv_env if enable_venv|bool else {}) }}"
when: build_ramdisk | bool == false and test_image_present.stat.exists == false and test_image_dib_present.stat.exists == false and test_image_initramfs_present.stat.exists == false
- name: "Initiate ramdisk build"
command: ramdisk-image-create {{dib_arglist}}
environment: "{{ dib_env_vars_final | combine(bifrost_venv_env if enable_venv|bool else '{}') }}"
environment: "{{ dib_env_vars_final | combine(bifrost_venv_env if enable_venv|bool else {}) }}"
when: build_ramdisk | bool == true and test_image_present.stat.exists == false and test_image_dib_present.stat.exists == false and test_image_initramfs_present.stat.exists == false
- name: "Update permission of generated image"
file:

View File

@ -98,12 +98,12 @@
- name: get list of nodes from virtualbmc
command: vbmc list
register: vbmc_list
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
# NOTE(NobodyCam): Space at the end of the find clause is required for proper matching.
- name: delete vm from virtualbmc if it is there
command: vbmc delete {{ vm_name }}
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
when: vbmc_list.stdout.find("{{ vm_name }} ") != -1
- set_fact:
@ -111,11 +111,11 @@
- name: plug vm into vbmc
command: vbmc add {{ vm_name }} --libvirt-uri {{ test_vm_libvirt_uri }} --port {{ virtual_ipmi_port }}
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: start virtualbmc
command: vbmc start {{ vm_name }}
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: get XML of the vm
virt:

View File

@ -160,14 +160,14 @@
- name: "Create ironic DB Schema"
command: ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
when: >
ironic.database.host == 'localhost' and
test_created_db.changed | bool == true
- name: "Upgrade ironic DB Schema"
command: ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
when: >
ironic.database.host != 'localhost' or
test_created_db.changed | bool == false
@ -184,7 +184,7 @@
- name: "Get ironic-api & ironic-conductor install location"
shell: echo $(dirname $(which ironic-api))
register: ironic_install_prefix
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: "Set permissions for /var/lib/ironic for the ironic user"
file:
path: "{{ item }}"

View File

@ -68,11 +68,11 @@
- name: "Upgrade inspector DB Schema"
shell: ironic-inspector-dbsync --config-file /etc/ironic-inspector/inspector.conf upgrade
become: true
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: "Inspector - Get ironic-inspector install location"
shell: echo $(dirname $(which ironic-inspector))
register: ironic_install_prefix
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: "Inspector - Place service"
template: src={{ init_template }} dest={{ init_dest_dir }}{{item.service_name}}{{ init_ext }} owner=root group=root
with_items:

View File

@ -55,4 +55,4 @@
retries: 5
delay: 10
when: source_install is defined and (source_install | bool == true)
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"

View File

@ -21,12 +21,12 @@
- name: "Get uwsgi install location"
shell: echo $(dirname $(which uwsgi))
register: uwsgi_install_prefix
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: "Get keystone-wsgi-admin location"
shell: echo $(dirname $(which keystone-wsgi-admin))
register: keystone_install_prefix
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
# NOTE(sean-k-mooney) only the RabbitMQ server and MySQL db are started
# during bootstrapping. all other services are started in the Start phase.
@ -126,7 +126,7 @@
- name: "Apply/Update keystone DB Schema"
command: keystone-manage db_sync
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: "Setup Keystone Credentials"
command: >
@ -144,7 +144,7 @@
--bootstrap-public-url="{{ keystone.bootstrap.public_url }}"
--bootstrap-internal-url="{{ keystone.bootstrap.internal_url }}"
--bootstrap-region-id="{{ keystone.bootstrap.region_name }}"
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
when: >
test_created_keystone_db.changed | bool == true and
keystone.bootstrap.enabled | bool == true and

View File

@ -25,4 +25,4 @@
- name: "Install from {{ sourcedir }} using pip"
command: pip install --upgrade {{ sourcedir }} {{ extra_args | default('') }}
when: source_install is defined and (source_install | bool == true)
environment: "{{ bifrost_venv_env if enable_venv else '{}' }}"
environment: "{{ bifrost_venv_env if enable_venv else {} }}"