Azure / Azure/azure-cli-extensions

[Container App] 'az containerapp create' fails when 'ingress' is not present in the yaml

Open
#5,756 14 comments 0 reactions 0 assignees View on GitHub
Auto-Assign bug ContainerApp customer-reported Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

## Describe the bug

`ingress` parameter under `properties` - `configuration` is defaulted to `None` if not provided in the yaml file. This causes this expression to fail:

https://github.com/Azure/azure-cli-extensions/blob/91447b8387457aa03052c37dd152412967fbe799/src/containerapp/azext_containerapp/custom.py#L294-L297

**Command Name**
`az containerapp create
Extension Name: containerapp. Version: 0.3.20.`

**Errors:**
```
The command failed with an unexpected error. Here is the traceback:
argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
raise ex
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_job
return cmd_copy.exception_handler(ex)
File "/home/josep/.azure/cliextensions/containerapp/azext_containerapp/_client_factory.py", line 28, in _polish_bad_errors
raise ex
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/home/josep/.azure/cliextensions/containerapp/azext_containerapp/custom.py", line 363, in create_containerapp
return create_containerapp_yaml(cmd=cmd, name=name, resource_group_name=resource_group_name, file_name=yaml, no_wait=no_wait)
File "/home/josep/.azure/cliextensions/containerapp/azext_containerapp/custom.py", line 302, in create_containerapp_yaml
handle_raw_exception(e)
File "/home/josep/.azure/cliextensions/containerapp/azext_containerapp/_client_factory.py", line 54, in handle_raw_exception
raise e
File "/home/josep/.azure/cliextensions/containerapp/azext_containerapp/custom.py", line 295, in create_containerapp_yaml
if "configuration" in r["properties"] and r["properties"]["configuration"] and "ingress" in r["properties"]["configuration"] and "fqdn" in r["properties"]["configuration"]["ingress"]:
TypeError: argument of type 'NoneType' is not iterable

```

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

- `az containerapp create --name {} --resource-group {} --yaml {}`

## Expected Behavior

## Environment Summary
```
Linux-5.15.79.1-microsoft-standard-WSL2-x86_64-with-glibc2.35, Ubuntu 22.04.1 LTS
Python 3.10.8
Installer: DEB

azure-cli 2.44.1

Extensions:
containerapp 0.3.20
log-analytics 0.2.2

Dependencies:
msal 1.20.0
azure-mgmt-resource 21.1.0b1
```
## 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.