azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

/usr/bin/az wrapper breaks when used as a symlink as of version 2.22.0

Open msftvito opened this issue 5 years ago • 1 comments

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug

When the az command run by the user is a symlink to the actual /usr/bin/az, for example /usr/local/bin/az->/usr/bin/az, the az wrapper complains it cannot find the azure module.

To Reproduce

yum -y install azure-cli ln -sf /usr/bin/az /usr/local/bin/az /usr/local/bin/az --version /usr/bin/python3: Error while finding module specification for 'azure.cli' (ModuleNotFoundError: No module named 'azure')

Expected behavior

azcli version output

Environment summary

yum, CentOS:7:latest, bash

Additional context

Introduced with https://github.com/Azure/azure-cli/commit/753a11c87575fedcc7425d4e34d332b17d8cd17b in the file scripts/release/rpm/azure-cli.spec

The removal of the hardcoded /usr/bin/python3 also has some implications for users running venvs as well.

msftvito avatar Jun 18 '21 20:06 msftvito

@jiasli for awareness

yonzhan avatar Jun 19 '21 00:06 yonzhan