Azure / Azure/azure-cli-extensions

name 'collection' is not defined for "az network firewall network-rule create"

Open
#4,406 4 comments 0 reactions 2 assignees Claimed by @necusjz View on GitHub
customer-reported feature-request needs-team-attention Network
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

### **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 "/home/andrew/lib/azure-cli/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/home/andrew/lib/azure-cli/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
raise ex
File "/home/andrew/lib/azure-cli/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/home/andrew/lib/azure-cli/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
result = cmd_copy(params)
File "/home/andrew/lib/azure-cli/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
return self.handler(*args, **kwargs)
File "/home/andrew/lib/azure-cli/lib/python3.6/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 390, in create_af_network_rule
item_name, params, collection_params)
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.

- _Put any pre-requisite steps here..._
- `az network firewall network-rule create --collection-name {} --destination-ports {} --firewall-name {} --name {} --protocols {} --resource-group {} --action {} --destination-addresses {} --source-addresses {} --priority {}`

## Expected Behavior

## Environment Summary
```
Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-with-Ubuntu-18.04-bionic, Ubuntu 18.04.5 LTS
Python 3.6.9
Installer:

azure-cli 2.33.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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.