Преглед на файлове

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
(cherry picked from commit bcca3fabe3)
tags/7.1.0
Mark Goddard преди 3 месеца
родител
ревизия
aaf34cfa25
променени са 2 файла, в които са добавени 11 реда и са изтрити 1 реда
  1. +5
    -1
      docker/keystone/keystone/keystone_bootstrap.sh
  2. +6
    -0
      releasenotes/notes/fix-keystone-bootstrap-unprintable-e01b088ef821fd18.yaml

+ 5
- 1
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


+ 6
- 0
releasenotes/notes/fix-keystone-bootstrap-unprintable-e01b088ef821fd18.yaml Целия файл

@@ -0,0 +1,6 @@
---
fixes:
- |
Fixes an issue with keystone bootstrap where an error message emitted by
the ``keystone-manage bootstrap`` command is hidden. See `bug 1855701
<https://bugs.launchpad.net/kolla-ansible/+bug/1855701>`__ for details.

Loading…
Отказ
Запис