Skip to content

az --version shows there are available updates when there is actually not #24221

Description

@jiasli

Related command
az --version
az upgrade

Describe the bug
Azure CLI has dropped support for some environments:

However, in those environments, az --version still shows there are available updates:

[root@ae6b254e11cf /]# az -v
azure-cli                         2.38.0 *

core                              2.38.0 *
telemetry                          1.0.6 *

Dependencies:
msal                            1.18.0b1
azure-mgmt-resource             21.1.0b1

Python location '/usr/bin/python3.6'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.6.8 (default, Nov 16 2020, 16:55:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

Legal docs and information: aka.ms/AzureCliLegal


You have 3 updates available. Consider updating your CLI installation with 'az upgrade'

This because Azure CLI checks the latest version from source code on GitHub repo, instead of corresponding package repo:

def get_latest_from_github(package_path='azure-cli'):
try:
import requests
git_url = "https://raw.githubusercontent.com/Azure/azure-cli/main/src/{}/setup.py".format(package_path)
response = requests.get(git_url, timeout=10)

To Reproduce
Lauch a CentOS 7 docker container and install Azure CLI:

docker run -it --rm centos:7

rpm --import https://packages.microsoft.com/keys/microsoft.asc

echo -e "[azure-cli]
name=Azure CLI
baseurl=https://packages.microsoft.com/yumrepos/azure-cli
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc" | tee /etc/yum.repos.d/azure-cli.repo

yum install azure-cli

az --version

Expected behavior
az --version shouldn't show available updates in those environments.

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions