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 33d184a731
)
This commit is contained in:
parent
80caffa8c8
commit
ab8bcf5a4f
|
@ -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
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Keystone bootstrap could produce invalid json.
|
||||
`LP#1866017 <https://launchpad.net/bugs/1866017>`__
|
Loading…
Reference in New Issue