diff options
| author | Radosław Piliszek <radoslaw.piliszek@gmail.com> | 2020-03-04 10:22:19 +0100 |
|---|---|---|
| committer | Radosław Piliszek <radoslaw.piliszek@gmail.com> | 2020-03-04 10:25:54 +0100 |
| commit | 33d184a731458bb45d1206bdae4fb172629a76e7 (patch) | |
| tree | 8a3752e837a2c3c4a939bab5509930cfc2704418 | |
| parent | e58653c436af6c3cc9f0dfd6019c43be8e5844da (diff) | |
| download | kolla-33d184a731458bb45d1206bdae4fb172629a76e7.tar.gz kolla-33d184a731458bb45d1206bdae4fb172629a76e7.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
| -rw-r--r-- | docker/keystone/keystone/keystone_bootstrap.sh | 4 | ||||
| -rw-r--r-- | releasenotes/notes/bug-1866017-9e31ddbfca9fd0f4.yaml | 5 |
2 files changed, 8 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 diff --git a/releasenotes/notes/bug-1866017-9e31ddbfca9fd0f4.yaml b/releasenotes/notes/bug-1866017-9e31ddbfca9fd0f4.yaml new file mode 100644 index 000000000..264a56b3e --- /dev/null +++ b/releasenotes/notes/bug-1866017-9e31ddbfca9fd0f4.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Keystone bootstrap could produce invalid json. + `LP#1866017 <https://launchpad.net/bugs/1866017>`__ |
