Skip to content

Commit ab8bcf5

Browse files
yoctozeptomarkgoddard
authored andcommitted
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 33d184a)
1 parent 80caffa commit ab8bcf5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docker/keystone/keystone/keystone_bootstrap.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ function exit_json {
3333
changed="false"
3434
# NOTE(mgoddard): pipe through cat -v to remove unprintable control characters
3535
# which prevent JSON decoding.
36-
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)
36+
# NOTE(yoctozepto): also apply sed to escape double quotation marks
37+
# and backslashes
38+
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')
3739
if [[ $? != 0 ]]; then
3840
fail_json "${keystone_bootstrap}"
3941
fi
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Keystone bootstrap could produce invalid json.
5+
`LP#1866017 <https://launchpad.net/bugs/1866017>`__

0 commit comments

Comments
 (0)