Source: Azure/azure-cli#32323 (by laorient)
Affected extension: containerapp (src/containerapp/)
<<UNTRUSTED:issue-32323>>
Issue #32323 (by laorient)
Title
containerapp update with yaml file results in exception
Body
Describe the bug
I am trying to use the yaml file to update container app with proper probes. But it failed in both 2.77 and 2.78 with the following error:
The command failed with an unexpected error. Here is the traceback:
'datetime.date' object has no attribute 'dict'
Related command
az containerapp update --yaml ./xxx.yaml --name xxx --resource-group yyy
Errors
'datetime.date' object has no attribute 'dict'
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 666, in execute
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 726, in _run_job
return cmd_copy.exception_handler(ex)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/_client_factory.py", line 28, in _polish_bad_errors
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job
result = cmd_copy(params)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 336, in call
return self.handler(*args, **kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
return op(**command_args)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/custom.py", line 749, in update_containerapp
return update_containerapp_logic(cmd=cmd,
name=name,
...<23 lines>...
no_wait=no_wait,
secret_volume_mount=secret_volume_mount)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/custom.py", line 368, in update_containerapp_logic
return update_containerapp_yaml(cmd=cmd, name=name, resource_group_name=resource_group_name, file_name=yaml, no_wait=no_wait, from_revision=from_revision)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/custom.py", line 209, in update_containerapp_yaml
containerapp_def = _convert_object_from_snake_to_camel_case(_object_to_dict(containerapp_def))
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/_utils.py", line 913, in _object_to_dict
return json.loads(json.dumps(obj, default=default_handler))
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.8/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/init.py", line 238, in dumps
**kw).encode(obj)
~~~~~~^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.8/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/opt/homebrew/Cellar/python@3.13/3.13.8/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/encoder.py", line 261, in iterencode
return _iterencode(o, 0)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/_utils.py", line 911, in default_handler
return x.dict
^^^^^^^^^^
AttributeError: 'datetime.date' object has no attribute 'dict'. Did you mean: 'dir'?
Issue script & Debug output
append --debug results in the same error message as above. But right before it emits the error messages, it has:
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/xxxx/resourceGroups/xxxx/providers/Microsoft.App/containerApps/xxx?api-version=2025-01-01 HTTP/1.1" 200 4714
Expected behavior
It should apply the new definition to the container app
Environment Summary
azure-cli: 2.77 and 2.78
Additional context
No response
Comments
Thank you for opening this issue, we will look into it.
Hi laorient
Can you show the repro yaml file?
Or Do you know which property in the yaml file using type datetime?
Thanks
Hi laorient
Can you show the repro yaml file?
Or Do you know which property in the yaml file using type datetime?
Thanks
I don't see any datetime property in my yaml. The only thing resemble one is the apiVersion.
<<END:issue-32323>>
Source: Azure/azure-cli#32323 (by laorient)
Affected extension:
containerapp(src/containerapp/)<<UNTRUSTED:issue-32323>>
Issue #32323 (by laorient)
Title
containerapp update with yaml file results in exception
Body
Describe the bug
I am trying to use the yaml file to update container app with proper probes. But it failed in both 2.77 and 2.78 with the following error:
The command failed with an unexpected error. Here is the traceback:
'datetime.date' object has no attribute 'dict'
Related command
az containerapp update --yaml ./xxx.yaml --name xxx --resource-group yyy
Errors
'datetime.date' object has no attribute 'dict'
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 666, in execute
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 726, in _run_job
return cmd_copy.exception_handler(ex)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/_client_factory.py", line 28, in _polish_bad_errors
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job
result = cmd_copy(params)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/init.py", line 336, in call
return self.handler(*args, **kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
return op(**command_args)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/custom.py", line 749, in update_containerapp
return update_containerapp_logic(cmd=cmd,
name=name,
...<23 lines>...
no_wait=no_wait,
secret_volume_mount=secret_volume_mount)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/custom.py", line 368, in update_containerapp_logic
return update_containerapp_yaml(cmd=cmd, name=name, resource_group_name=resource_group_name, file_name=yaml, no_wait=no_wait, from_revision=from_revision)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/custom.py", line 209, in update_containerapp_yaml
containerapp_def = _convert_object_from_snake_to_camel_case(_object_to_dict(containerapp_def))
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/_utils.py", line 913, in _object_to_dict
return json.loads(json.dumps(obj, default=default_handler))
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.8/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/init.py", line 238, in dumps
**kw).encode(obj)
~~~~~~^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.8/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/opt/homebrew/Cellar/python@3.13/3.13.8/Frameworks/Python.framework/Versions/3.13/lib/python3.13/json/encoder.py", line 261, in iterencode
return _iterencode(o, 0)
File "/opt/homebrew/Cellar/azure-cli/2.78.0/libexec/lib/python3.13/site-packages/azure/cli/command_modules/containerapp/_utils.py", line 911, in default_handler
return x.dict
^^^^^^^^^^
AttributeError: 'datetime.date' object has no attribute 'dict'. Did you mean: 'dir'?
Issue script & Debug output
append --debug results in the same error message as above. But right before it emits the error messages, it has:
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/xxxx/resourceGroups/xxxx/providers/Microsoft.App/containerApps/xxx?api-version=2025-01-01 HTTP/1.1" 200 4714
Expected behavior
It should apply the new definition to the container app
Environment Summary
azure-cli: 2.77 and 2.78
Additional context
No response
Comments
Comment by Yong Zhang (@yonzhan)
Thank you for opening this issue, we will look into it.
Comment by Greedygre (@Greedygre)
Hi laorient
Can you show the repro yaml file?
Or Do you know which property in the yaml file using type
datetime?Thanks
Comment by laorient
I don't see any datetime property in my yaml. The only thing resemble one is the apiVersion.
<<END:issue-32323>>