From 441f257db68ecc3b249b1570952150e62b47811d Mon Sep 17 00:00:00 2001 From: seaHi Date: Wed, 30 Sep 2026 13:52:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=20Keystone=20?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E9=87=8D=E8=AF=95=E9=80=BB=E8=BE=91=E5=B9=B6?= =?UTF-8?q?=E6=8D=95=E8=8E=B7=E8=BE=93=E5=87=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- env3-3-local.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/env3-3-local.sh b/env3-3-local.sh index 9c7e4e3..f93ff42 100755 --- a/env3-3-local.sh +++ b/env3-3-local.sh @@ -364,11 +364,19 @@ source "$ADMIN_OPENRC" # Apache 启动后,等待 Keystone 实际可以签发令牌(不输出令牌内容)。 log_info "等待 Keystone 管理员认证就绪..." for attempt in {1..12}; do - if openstack --os-auth-type password --os-api-timeout 10 token issue > /dev/null; then + # 捕获两个输出通道,认证失败时保留客户端错误,成功时不显示令牌。 + if KEYSTONE_AUTH_OUTPUT=$(openstack --os-auth-type password token issue 2>&1); then + unset KEYSTONE_AUTH_OUTPUT + log_info "Keystone 管理员认证成功。" break + else + KEYSTONE_AUTH_STATUS=$? fi + log_warn "Keystone 认证尚未就绪(第 $attempt/12 次,退出码 $KEYSTONE_AUTH_STATUS)。" + printf '%s\n' "${KEYSTONE_AUTH_OUTPUT:-客户端未返回错误信息。}" >&2 + unset KEYSTONE_AUTH_OUTPUT if [ "$attempt" -eq 12 ]; then - log_err "Keystone 认证失败,请检查 httpd、Keystone 配置和管理员密码。" + log_err "Keystone 认证失败,请根据上方客户端错误检查连接、服务配置或管理员凭证。" exit 1 fi sleep 2 @@ -485,7 +493,7 @@ systemctl restart openstack-glance-api openstack-glance-registry log_info "验证 Glance API 和管理员访问..." for attempt in {1..12}; do - if openstack --os-api-timeout 10 --os-image-api-version 2 image list; then + if openstack --os-image-api-version 2 image list; then break fi if [ "$attempt" -eq 12 ]; then