Skip to content

Commit 34366a1

Browse files
committed
<fix>[conf]: use absolute path for ansible version check during upgrade
upgrade from py2 venv to py3 venv, ensure_python3_venv recreates an empty venv with no ansible binary. The bare 'ansible --version' falls back to /usr/bin/ansible old wrapper which uses relative path, causing infinite recursion on kylin arm environments. Use absolute path $SYS_VIRENV_PATH/bin/ansible with existence check to avoid hitting the old wrapper. Resolves: ZSTAC-82619 Change-Id: I666461626876787762626b6f6261776d76767262
1 parent 0f4c337 commit 34366a1

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

conf/tools/install.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,8 @@ elif [ $tool = 'zstack-ctl' ]; then
9494
elif [ $tool = 'zstack-sys' ]; then
9595
SYS_VIRENV_PATH=/var/lib/zstack/virtualenv/zstacksys
9696
ensure_python3_venv "$SYS_VIRENV_PATH"
97-
RE_INSTALL=false
98-
. $SYS_VIRENV_PATH/bin/activate
99-
if ! ansible --version | grep -q 'core 2.16.14'; then
100-
deactivate
101-
RE_INSTALL=true
102-
fi
103-
if $RE_INSTALL; then
97+
# RE_INSTALL
98+
if [ ! -x "$SYS_VIRENV_PATH/bin/ansible" ] || ! "$SYS_VIRENV_PATH/bin/ansible" --version 2>/dev/null | grep -q 'core 2.16.14'; then
10499
rm -rf $SYS_VIRENV_PATH && python3.11 -m venv $SYS_VIRENV_PATH || exit 1
105100
. $SYS_VIRENV_PATH/bin/activate
106101
cd $cwd

0 commit comments

Comments
 (0)