Azure / azure-cli

Azure Command-Line Interface
MIT License
4.02k stars 2.99k forks source link

az upgrade loops continuously on MacOS #19196

Open jashby44 opened 3 years ago

jashby44 commented 3 years ago

Describe the bug

Command Name az upgrade

Errors:

Upgrade says it will update to 2.27.1, but keeps looping and never completes:

$ az upgrade
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Your current Azure CLI version is 2.27.0. Latest version available is 2.27.1.
Please check the release notes first: https://docs.microsoft.com/cli/azure/release-notes-azure-cli
Do you want to continue? (Y/n): Y
Already up-to-date.
Warning: azure-cli 2.27.0 already installed
WARNING: New Azure CLI version available. Running 'az upgrade' to update automatically.
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
WARNING: Your current Azure CLI version is 2.27.0. It will be updated to 2.27.1.
Warning: azure-cli 2.27.0 already installed
WARNING: New Azure CLI version available. Running 'az upgrade' to update automatically.
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
WARNING: Your current Azure CLI version is 2.27.0. It will be updated to 2.27.1.
Warning: azure-cli 2.27.0 already installed
WARNING: New Azure CLI version available. Running 'az upgrade' to update automatically.
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
WARNING: Your current Azure CLI version is 2.27.0. It will be updated to 2.27.1.
Warning: azure-cli 2.27.0 already installed
WARNING: New Azure CLI version available. Running 'az upgrade' to update automatically.
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
WARNING: Your current Azure CLI version is 2.27.0. It will be updated to 2.27.1.
Warning: azure-cli 2.27.0 already installed
WARNING: New Azure CLI version available. Running 'az upgrade' to update automatically.
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
WARNING: Your current Azure CLI version is 2.27.0. It will be updated to 2.27.1.
Warning: azure-cli 2.27.0 already installed
WARNING: New Azure CLI version available. Running 'az upgrade' to update automatically.
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
WARNING: Your current Azure CLI version is 2.27.0. It will be updated to 2.27.1.
^C

To Reproduce:

Run an upgrade from MacOS terminal:

az upgrade

Expected Behavior

Environment Summary

macOS-10.15.7-x86_64-i386-64bit
Python 3.8.11
Installer: HOMEBREW

azure-cli 2.27.0 *

Extensions:
account 0.2.1

Brew version:

$ brew --version
Homebrew 3.2.6
Homebrew/homebrew-core (git revision 5ca8f7e4272; last commit 2021-08-11)
Homebrew/homebrew-cask (git revision 6fa2cf3682; last commit 2021-08-11)

Additional Context

Here is some debug output:

$ az upgrade --debug
cli.knack.cli: Command arguments: ['upgrade', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x110b78700>, <function OutputProducer.on_global_arguments at 0x110be1940>, <function CLIQuery.on_global_arguments at 0x110c26160>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'upgrade': ['azure.cli.command_modules.util']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: util                      0.002         2         4
cli.azure.cli.core: Total (1)                 0.002         2         4
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: Total (0)                 0.000         0         0  
cli.azure.cli.core: Loaded 2 groups, 4 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : upgrade
cli.azure.cli.core: Command table: upgrade
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x1113aaca0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/me/.azure/commands/2021-08-11.13-14-16.upgrade.90954.log'.
az_command_data_logger: command args: upgrade --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x1113cc160>, <function register_global_query_examples_argument.<locals>.register_query_examples at 0x111423c10>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x111423ca0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x111423dc0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x110be19d0>, <function CLIQuery.handle_query_parameter at 0x110c261f0>, <function register_global_query_examples_argument.<locals>.handle_example_parameter at 0x111423b80>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x111423d30>]
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
urllib3.connectionpool: Starting new HTTPS connection (1): raw.githubusercontent.com:443
urllib3.connectionpool: https://raw.githubusercontent.com:443 "GET /Azure/azure-cli/master/src/azure-cli/setup.py HTTP/1.1" 200 2296
cli.azure.cli.command_modules.util.custom: Your current Azure CLI version is 2.27.0. Latest version available is 2.27.1.
cli.azure.cli.command_modules.util.custom: Please check the release notes first: https://docs.microsoft.com/cli/azure/release-notes-azure-cli
Do you want to continue? (Y/n): Y
cli.azure.cli.command_modules.util.custom: Update homebrew formulae
Already up-to-date.
cli.azure.cli.command_modules.util.custom: Update azure cli with 'brew upgrade azure-cli'
Warning: azure-cli 2.27.0 already installed
WARNING: New Azure CLI version available. Running 'az upgrade' to update automatically.
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
WARNING: Your current Azure CLI version is 2.27.0. It will be updated to 2.27.1.
Warning: azure-cli 2.27.0 already installed
WARNING: New Azure CLI version available. Running 'az upgrade' to update automatically.
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
WARNING: Your current Azure CLI version is 2.27.0. It will be updated to 2.27.1.
Warning: azure-cli 2.27.0 already installed
WARNING: New Azure CLI version available. Running 'az upgrade' to update automatically.
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
WARNING: Your current Azure CLI version is 2.27.0. It will be updated to 2.27.1.
^C

Perhaps a Homebrew issue, but I'm not super familiar with troubleshooting brew, so if anything I can look into please let me know. Thanks

jashby44 commented 3 years ago

I previously enabled auto upgrade. For now I've disabled it again with the following so I can run az commands without being prompted to upgrade:

az config set auto-upgrade.enable=no
yonzhan commented 3 years ago

@jiasli for awareness

jiasli commented 3 years ago

On a first glance, this is because 2.27.1 is available on GitHub:

https://github.com/Azure/azure-cli/blob/da3ff654f80f749525ee5c321c37dc041f1061d2/src/azure-cli-core/setup.py#L11

but not available on Homebrew yet because the PR has not been merged:

Then a loop happens:

jiasli commented 3 years ago

We have released 2.27.1 and this issue should be fixed. (Still, we need to solve the endless loop issue.)