[Core] az --version: Show command instruction and detailed instruction link when updates available#12981
Conversation
|
for upgrade |
| "HOMEBREW": ("brew update && brew upgrade azure-cli", "https://aka.ms/doc/UpdateAzureCliHomebrew"), | ||
| "PIP": ("curl -L https://aka.ms/InstallAzureCli | bash", "https://aka.ms/doc/UpdateAzureCliLinux"), | ||
| "MSI": ("https://aka.ms/installazurecliwindows", "https://aka.ms/doc/UpdateAzureCliMsi"), | ||
| "DOCKER": ("docker pull mcr.microsoft.com/azure-cli", "https://aka.ms/doc/UpdateAzureCliDocker")} |
There was a problem hiding this comment.
just confirm, those short urls are all maintained actively
There was a problem hiding this comment.
all of them are active now.
| updates_available) | ||
| warning_msg = 'You have %i updates available. Consider updating your CLI installation' | ||
| from azure.cli.core._environment import _ENV_AZ_INSTALLER | ||
| installer = os.getenv(_ENV_AZ_INSTALLER) |
There was a problem hiding this comment.
do we really need to print different messages based on platform? what about show all upgrade instructions?
There was a problem hiding this comment.
The current link shown is doing something similiar, it puts all the links to each package in one page. But we got complains about it's not being useful, some users may not know their operating system or packaging well, they have difficulties to find the right instruction.
|
It would be helpful to show some rendered results in the PR description. |
| return None, None | ||
|
|
||
| try: | ||
| with open('/etc/os-release') as lines: |
There was a problem hiding this comment.
Copy and paste a sample for other reviewers:
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
Description
We can now rely on the
AZ_INSTALLERenv variable to know how the running Azure CLI is installed, so we can show specific instructions on how to update Azure CLI.Example for Ubuntu:
For windows, for simplicity let's just recommend the MSI link for upgrading(The upgrade cmdlet on powershell needs to be run as Administrator and I'm still looking for the alternative to psutil to decide if CLI is running in Powershell):
For pip, 2 options for Linux and MacOS:
Linux/MacOs:
Windows:
Testing Guide
History Notes
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.