Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
382 stars 1.21k forks source link

az network firewall network-rule create command failed #4478

Open myers-dev opened 2 years ago

myers-dev commented 2 years ago

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az network firewall network-rule create Extension Name: azure-firewall. Version: 0.13.0.

Errors:

The command failed with an unexpected error. Here is the traceback:
name 'collection' is not defined
Traceback (most recent call last):
  File "/opt/az/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
    raise ex
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/home/andrew/.azure/cliextensions/azure-firewall/azext_firewall/custom.py", line 388, in create_af_network_rule
    return _upsert_af_rule(cmd, resource_group_name, azure_firewall_name,
  File "/home/andrew/.azure/cliextensions/azure-firewall/azext_firewall/custom.py", line 343, in _upsert_af_rule
    collection_match = next((x for x in collection if x.name.lower() == collection_name.lower()), None)
NameError: name 'collection' is not defined

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Expected Behavior

Environment Summary

Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-glibc2.27, Ubuntu 18.04.5 LTS
Python 3.8.12
Installer: DEB

azure-cli 2.34.0

Extensions:
azure-devops 0.23.0
azure-firewall 0.13.0
virtual-wan 0.2.11

Dependencies:
msal 1.16.0
azure-mgmt-resource 20.0.0

Additional Context

yonzhan commented 2 years ago

network

YuanyuanNi commented 2 years ago

Hi, @myers-dev It cannot be reproduced in 2.34.1, and my command is :"az network firewall network-rule create --collection-name XXX --priority 500 --action allow --destination-ports XXX --firewall-name XXX --name XXX --protocols XXX --resource-group XXX --destination-addresses XXX --source-addresses XXX."maybe you can upgrade your cli and try again. Best wishes.