File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99start_time = timeit .default_timer ()
1010
1111import sys
12+ import os
1213
1314from azure .cli .core import telemetry
1415from azure .cli .core import get_default_cli
2223
2324logger = get_logger (__name__ )
2425
26+ AZURELINUX2_WARNING_MESSAGE = (
27+ "Azure CLI 2.74.0 is the last version available on Azure Linux (Mariner) 2.0 and will not receive updates. "
28+ "Consider migrating to Azure Linux 3.0 to use newer versions of Azure CLI. "
29+ "To disable this warning message, set AZURE_CLI_DISABLE_AZURELINUX2_WARNING environment variable to any value."
30+ )
31+
2532
2633def cli_main (cli , args ):
2734 return cli .invoke (args )
@@ -96,7 +103,6 @@ def cli_main(cli, args):
96103 else :
97104 upgrade_exit_code = subprocess .call (cmd , shell = platform .system () == 'Windows' )
98105 else :
99- import os
100106 devnull = open (os .devnull , 'w' )
101107 cmd .append ('-y' )
102108 upgrade_exit_code = subprocess .call (cmd , shell = platform .system () == 'Windows' , stdout = devnull )
@@ -115,6 +121,9 @@ def cli_main(cli, args):
115121 except Exception as ex : # pylint: disable=broad-except
116122 logger .debug ("Intercept survey prompt failed. %s" , str (ex ))
117123
124+ if 'AZURE_CLI_DISABLE_AZURELINUX2_WARNING' not in os .environ :
125+ logger .warning (AZURELINUX2_WARNING_MESSAGE )
126+
118127 telemetry .set_init_time_elapsed ("{:.6f}" .format (init_finish_time - start_time ))
119128 telemetry .set_invoke_time_elapsed ("{:.6f}" .format (invoke_finish_time - init_finish_time ))
120129 telemetry .conclude ()
You can’t perform that action at this time.
0 commit comments