From 7bd82ddd70ed00e12cc8c1a22bf8b39485372e8b Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Fri, 7 Aug 2015 15:47:24 +0000 Subject: [PATCH] Encode user-supplied metadata as json We need to perform json encoding on these values because they may contain characters like newlines or quotes, etc. Change-Id: I84a17a97e7a245c92e7d91c85ce86277aef22d2e --- .../templates/openstack_meta_data.json.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/bifrost-configdrives-dynamic/templates/openstack_meta_data.json.j2 b/playbooks/roles/bifrost-configdrives-dynamic/templates/openstack_meta_data.json.j2 index e3cc207f7..b84a15e85 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/templates/openstack_meta_data.json.j2 +++ b/playbooks/roles/bifrost-configdrives-dynamic/templates/openstack_meta_data.json.j2 @@ -10,11 +10,11 @@ {% else %} "files": [], {% endif %} - "hostname": "{{ name }}", - "name": "{{ name }}", + "hostname": {{ name|to_json }}, + "name": {{ name|to_json }}, "meta": {}, "public_keys": { - "mykey": "{{ ssh_public_key }}" + "mykey": {{ ssh_public_key|to_json }} }, "uuid": "{{ uuid }}" }