Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using az containerapp hostname bind without validation-method throws AttributeError #6480

Closed
dylan8902 opened this issue Jul 5, 2023 · 4 comments
Labels
Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. ContainerApp customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.

Comments

@dylan8902
Copy link
Contributor

Describe the bug

When using az containerapp hostname bind, the command fails without the --validation-method input

The method bind_hostname here https://github.com/Azure/azure-cli-extensions/blob/main/src/containerapp/azext_containerapp/custom.py#L4419 has a default value of None but .upper() is called https://github.com/Azure/azure-cli-extensions/blob/main/src/containerapp/azext_containerapp/custom.py#L4463

There should be a check and RequiredArgumentMissingError raised before it is used

Related command

az containerapp hostname bind --hostname something.test.net -g MY-GROUP -n my-container-app -e my-container-app-env

Errors

The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute 'upper'
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/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/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_job
    return cmd_copy.exception_handler(ex)
  File "/Users/dylan.jones/.azure/cliextensions/containerapp/azext_containerapp/_client_factory.py", line 28, in _polish_bad_errors
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/Users/dylan.jones/.azure/cliextensions/containerapp/azext_containerapp/custom.py", line 4360, in bind_hostname
    validation = validation_method.upper()
AttributeError: 'NoneType' object has no attribute 'upper'

Issue script & Debug output

az containerapp hostname bind --hostname something.test.net -g MY-GROUP -n my-container-app -e my-container-app-env --debug

Debug log not needed

Expected behavior

A RequiredArgumentMissingError should be raised so the command exists cleanly in error state with the correct information for a user to correct the issue.

raise RequiredArgumentMissingError('Please specify the parameter: --validation-method')

Environment Summary

azure-cli                         2.50.0

core                              2.50.0
telemetry                          1.0.8

Extensions:
account                            0.2.5
application-insights              0.1.19
azure-devops                      0.26.0
communication                      1.5.2
containerapp                      0.3.32

Dependencies:
msal                              1.22.0
azure-mgmt-resource             23.1.0b2

Python location '/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/bin/python'
Extensions directory '/Users/dylan.jones/.azure/cliextensions'

Python (Darwin) 3.10.12 (main, Jun 20 2023, 19:43:52) [Clang 14.0.3 (clang-1403.0.22.14.1)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context

I will raise a PR to fix, feel free to assign it to me

@dylan8902 dylan8902 added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jul 5, 2023
@ghost ghost added question The issue doesn't require a change to the product in order to be resolved. Most issues start as that customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Jul 5, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Jul 5, 2023

Thank you for opening this issue, we will look into it.

@ghost ghost added Auto-Assign Auto assign by bot ContainerApp CXP Attention This issue is handled by CXP team. labels Jul 5, 2023
@dylan8902
Copy link
Contributor Author

I have raised #6481

@navba-MSFT navba-MSFT added Service Attention This issue is responsible by Azure service team. needs-team-attention This issue needs attention from Azure service team or SDK team and removed CXP Attention This issue is handled by CXP team. labels Jul 10, 2023
@ghost
Copy link

ghost commented Jul 10, 2023

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @calvinsID.

Issue Details

Describe the bug

When using az containerapp hostname bind, the command fails without the --validation-method input

The method bind_hostname here https://github.com/Azure/azure-cli-extensions/blob/main/src/containerapp/azext_containerapp/custom.py#L4419 has a default value of None but .upper() is called https://github.com/Azure/azure-cli-extensions/blob/main/src/containerapp/azext_containerapp/custom.py#L4463

There should be a check and RequiredArgumentMissingError raised before it is used

Related command

az containerapp hostname bind --hostname something.test.net -g MY-GROUP -n my-container-app -e my-container-app-env

Errors

The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute 'upper'
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/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/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_job
    return cmd_copy.exception_handler(ex)
  File "/Users/dylan.jones/.azure/cliextensions/containerapp/azext_containerapp/_client_factory.py", line 28, in _polish_bad_errors
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/Users/dylan.jones/.azure/cliextensions/containerapp/azext_containerapp/custom.py", line 4360, in bind_hostname
    validation = validation_method.upper()
AttributeError: 'NoneType' object has no attribute 'upper'

Issue script & Debug output

az containerapp hostname bind --hostname something.test.net -g MY-GROUP -n my-container-app -e my-container-app-env --debug

Debug log not needed

Expected behavior

A RequiredArgumentMissingError should be raised so the command exists cleanly in error state with the correct information for a user to correct the issue.

raise RequiredArgumentMissingError('Please specify the parameter: --validation-method')

Environment Summary

azure-cli                         2.50.0

core                              2.50.0
telemetry                          1.0.8

Extensions:
account                            0.2.5
application-insights              0.1.19
azure-devops                      0.26.0
communication                      1.5.2
containerapp                      0.3.32

Dependencies:
msal                              1.22.0
azure-mgmt-resource             23.1.0b2

Python location '/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/bin/python'
Extensions directory '/Users/dylan.jones/.azure/cliextensions'

Python (Darwin) 3.10.12 (main, Jun 20 2023, 19:43:52) [Clang 14.0.3 (clang-1403.0.22.14.1)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context

I will raise a PR to fix, feel free to assign it to me

Author: dylan8902
Assignees: -
Labels:

bug, question, customer-reported, Service Attention, needs-team-attention, Auto-Assign, ContainerApp

Milestone: -

@navba-MSFT
Copy link
Contributor

Adding Service team to look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. ContainerApp customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

3 participants