Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] az --version: Show command instruction and detailed instruction link when updates available #12981

Merged
merged 5 commits into from
Apr 16, 2020

Conversation

fengzhou-msft
Copy link
Member

@fengzhou-msft fengzhou-msft commented Apr 13, 2020

Description

We can now rely on the AZ_INSTALLER env 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:

You have 2 updates available. Consider updating your CLI installation with 'sudo apt-get update && sudo apt-get install --only-upgrade -y azure-cli'. Detailed instructions can be found at https://aka.ms/doc/UpdateAzureCliApt

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):

You have 2 updates available. Consider updating your CLI installation with 'https://aka.ms/installazurecliwindows'. Detailed instructions can be found at https://aka.ms/doc/UpdateAzureCliMsi

For pip, 2 options for Linux and MacOS:
Linux/MacOs:

You have 2 updates available. Consider updating your CLI installation with 'pip install --upgrade azure-cli' or 'curl -L https://aka.ms/InstallAzureCli | bash' if you used our script for installing. Detailed instructions can be found at https://aka.ms/doc/UpdateAzureCliLinux

Windows:

You have 2 updates available. Consider updating your CLI installation with 'pip install --upgrade azure-cli'

Testing Guide

History Notes


This checklist is used to make sure that common guidelines for a pull request are followed.

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 13, 2020

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")}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just confirm, those short urls are all maintained actively

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need to print different messages based on platform? what about show all upgrade instructions?

Copy link
Member Author

@fengzhou-msft fengzhou-msft Apr 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jiasli
Copy link
Member

jiasli commented Apr 14, 2020

It would be helpful to show some rendered results in the PR description.

return None, None

try:
with open('/etc/os-release') as lines:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@fengzhou-msft fengzhou-msft merged commit 3b4d10d into Azure:dev Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants