Browse Source

Escape invalid JSON characters during deployment.

By first quoting the JSON query, it is possible to easily pass
it to the json_query plugin. This allows elements with special
characters, such as a hyphen -, to be resolvable.

Conflicts:
    tripleo_common/templates/deployments.yaml

Change-Id: I56f3e5f96dc25f16aed585ca6678de53721071b7
Closes-Bug: #1853321
Signed-off-by: Luke Short <ekultails@gmail.com>
(cherry picked from commit f81e0bf426)
changes/50/695750/1
Luke Short 3 months ago
parent
commit
5610fae465
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      tripleo_common/templates/deployments.yaml

+ 7
- 2
tripleo_common/templates/deployments.yaml View File

@@ -1,10 +1,15 @@
- name: Quote the JSON queries to escape invalid characters
set_fact:
item_id: '"{{ item }}".id'
item_only: '"{{ item }}"'

- name: Lookup deployment UUID
set_fact:
deployment_uuid: "{{ lookup('file', role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item ~ '.id')}}"
deployment_uuid: "{{ lookup('file', role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item_id)}}"

- name: "Render deployment file for {{ item }}"
copy:
content: "[ {{ lookup('file', role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item) }} ]"
content: "[ {{ lookup('file', role_name ~ '/' ~ ansible_hostname | lower ~ '/' ~ item) | from_yaml | json_query(item_only) }} ]"
dest: "/var/lib/heat-config/tripleo-config-download/{{ item }}"
become: true


Loading…
Cancel
Save