summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorRadosław Piliszek <radoslaw.piliszek@gmail.com>2020-03-04 10:22:19 +0100
committerMark Goddard <mark@stackhpc.com>2020-04-14 12:44:06 +0000
commit44ef591464d03960d0bc8c322cacbb97a44968fe (patch)
tree56f9a33595f7e60e9ccc22901c93a66960c859d9 /docker
parent2506a14dbd4c4c4ddb26871a0cad251b5718ca59 (diff)
downloadkolla-44ef591464d03960d0bc8c322cacbb97a44968fe.tar.gz
kolla-44ef591464d03960d0bc8c322cacbb97a44968fe.zip
Ensure proper JSON in keystone bootstrap
This fixes the issue when keystone-manage output included backslashes and/or double quotation marks which broke JSON string. Change-Id: Ifae18c407210c12745d29fc4c95dca69aeafe6a8 Closes-bug: #1866017 (cherry picked from commit 33d184a731458bb45d1206bdae4fb172629a76e7)
Diffstat (limited to 'docker')
-rw-r--r--docker/keystone/keystone/keystone_bootstrap.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/docker/keystone/keystone/keystone_bootstrap.sh b/docker/keystone/keystone/keystone_bootstrap.sh
index e37e38352..15a79c3eb 100644
--- a/docker/keystone/keystone/keystone_bootstrap.sh
+++ b/docker/keystone/keystone/keystone_bootstrap.sh
@@ -33,7 +33,9 @@ function exit_json {
changed="false"
# NOTE(mgoddard): pipe through cat -v to remove unprintable control characters
# which prevent JSON decoding.
-keystone_bootstrap=$(keystone-manage bootstrap --bootstrap-username "${USERNAME}" --bootstrap-password "${PASSWORD}" --bootstrap-project-name "${PROJECT}" --bootstrap-role-name "${ROLE}" --bootstrap-admin-url "${ADMIN_URL}" --bootstrap-internal-url "${INTERNAL_URL}" --bootstrap-public-url "${PUBLIC_URL}" --bootstrap-service-name "keystone" --bootstrap-region-id "${REGION}" 2>&1 | cat -v)
+# NOTE(yoctozepto): also apply sed to escape double quotation marks
+# and backslashes
+keystone_bootstrap=$(keystone-manage bootstrap --bootstrap-username "${USERNAME}" --bootstrap-password "${PASSWORD}" --bootstrap-project-name "${PROJECT}" --bootstrap-role-name "${ROLE}" --bootstrap-admin-url "${ADMIN_URL}" --bootstrap-internal-url "${INTERNAL_URL}" --bootstrap-public-url "${PUBLIC_URL}" --bootstrap-service-name "keystone" --bootstrap-region-id "${REGION}" 2>&1 | cat -v | sed 's/\\/\\\\/g' | sed 's/"/\\"/g')
if [[ $? != 0 ]]; then
fail_json "${keystone_bootstrap}"
fi