* Luca Boccassi <bl...@debian.org>, 2020-07-10, 09:54:
(note that the monitor functionality is but one of the many features
and subcommands, hence the downgrade in severity).

It's not just the monitor functionality, whatever that is.
All the "az vm" commands are broken, e.g.:

  $ az vm list
  The command failed with an unexpected error. Here is the traceback:

  No module named 'antlr4'
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/knack/cli.py", line 215, in invoke
      cmd_result = self.invocation.execute(args)
    File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", 
line 553, in execute
      self.commands_loader.load_arguments(command)
    File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 345, 
in load_arguments
      loader.load_arguments(command)  # this adds entries to the argument 
registries
    File 
"/usr/lib/python3/dist-packages/azure/cli/command_modules/vm/__init__.py", line 
31, in load_arguments
      from azure.cli.command_modules.vm._params import load_arguments
    File "/usr/lib/python3/dist-packages/azure/cli/command_modules/vm/_params.py", 
line 31, in <module>
      from azure.cli.command_modules.monitor.actions import get_period_type
    File 
"/usr/lib/python3/dist-packages/azure/cli/command_modules/monitor/actions.py", line 
7, in <module>
      import antlr4
  ModuleNotFoundError: No module named 'antlr4'

The "az vm" commands are so fundamental, that this bug renders the package unusable IMO.

As a quick&dirty work-around, I've moved the import to the function that uses it; see the attachment.

--
Jakub Wilk
--- unpacked/usr/lib/python3/dist-packages/azure/cli/command_modules/monitor/actions.py	2020-05-29 09:56:48.000000000 +0200
+++ /usr/lib/python3/dist-packages/azure/cli/command_modules/monitor/actions.py	2020-07-10 16:07:49.530265759 +0200
@@ -4,7 +4,6 @@
 # --------------------------------------------------------------------------------------------
 
 import argparse
-import antlr4
 
 from azure.cli.command_modules.monitor.util import (
     get_aggregation_map, get_operator_map, get_autoscale_operator_map,
@@ -92,6 +91,7 @@
 class MetricAlertConditionAction(argparse._AppendAction):
 
     def __call__(self, parser, namespace, values, option_string=None):
+        import antlr4
         from azure.cli.command_modules.monitor.grammar import (
             MetricAlertConditionLexer, MetricAlertConditionParser, MetricAlertConditionValidator)
 

Reply via email to