aboutsummaryrefslogtreecommitdiff
path: root/docker/keystone
diff options
context:
space:
mode:
authorMark Goddard <mark@stackhpc.com>2019-12-09 11:11:26 +0000
committerMark Goddard <mark@stackhpc.com>2019-12-09 11:14:36 +0000
commitbcca3fabe305c1e206fdb231c31809ceff2d4774 (patch)
treee670b9cc6a3ebd962bab1ef1aba876cac40139ef /docker/keystone
parentc5cbea5d2932d68bbf572c6c856aed8a7fe9b0a7 (diff)
downloadkolla-bcca3fabe305c1e206fdb231c31809ceff2d4774.tar.gz
kolla-bcca3fabe305c1e206fdb231c31809ceff2d4774.zip
Fix keystone bootstrap error message display
In some situations, Keystone bootstrap can fail, and then unhelpfully fails displaying the error message output by the 'keystone-manage bootstrap' command. This appears to be due to unprintable control characters in the error message which prevent the output of the script from being valid JSON. This change fixes the issue by piping the output through 'cat -v', which replaces unprintable characters with control codes. Change-Id: I82444bc2272311023cc9e92c5a298d1c4c87483b Closes-Bug: #1855701
Diffstat (limited to 'docker/keystone')
-rw-r--r--docker/keystone/keystone/keystone_bootstrap.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/docker/keystone/keystone/keystone_bootstrap.sh b/docker/keystone/keystone/keystone_bootstrap.sh
index c140e97c7..e37e38352 100644
--- a/docker/keystone/keystone/keystone_bootstrap.sh
+++ b/docker/keystone/keystone/keystone_bootstrap.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+set -o pipefail
+
# NOTE(SamYaple): Kolla needs to wraps `keystone-manage bootstrap` to ensure
# any change is reported correctly for idempotency. This script will exit with
# valid json that can be parsed with information about if the task has failed
@@ -29,7 +31,9 @@ function exit_json {
}
changed="false"
-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)
+# 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)
if [[ $? != 0 ]]; then
fail_json "${keystone_bootstrap}"
fi