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

cache_configuration cannot be set to Null (None in Python) to remove AFD Route Caching once turned on #35801

Closed
jartoo opened this issue May 29, 2024 · 11 comments
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-author-feedback Workflow: More information is needed from author to address the issue. Network - CDN question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@jartoo
Copy link

jartoo commented May 29, 2024

  • Package Name: azure-mgmt-cdn
  • Package Version: 13.1.0
  • Operating System: MacOS M1 ARM
  • Python Version: 3.10.11

Describe the bug
When using the RouteUpdateParameters class to remove Caching from an existing Route, it requires you to pass null, which in Python uses the None keyword, to the cache_configuration object. It does not remove the caching when trying to update the Route.

To Reproduce
Steps to reproduce the behavior:

  1. Create an Azure Front Door Standard CDN Profile
  2. Create an Endpoint, Origin-Group, Origin and Rule Set.
  3. Create a Route with Caching enabled (you can select any options as the options do not matter
  4. Attempt to update the Route to remove the Caching, by calling RouteOperations.begin_update(), which requires you to set the cache_configuration to "null", which uses the None keyword
  5. Check the caching status in the portal to confirm it was disabled and you will see it is not.

Expected behavior
The Caching should then be disabled, since there is no explicit variable to toggle the caching on or off, like exists in the Azure Portal.

Screenshots
N/A

Additional context
Tracing the Python SDK seems to remove all the variables set to None as part of the _serialization.py when executing the _routes_operations.py begin_update function. Since the cache_configuration object is set to None I cannot figure out how to get it to pass a Null to the API. Am I missing something here? Thanks.

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels May 29, 2024
@xiangyan99 xiangyan99 added Network - CDN Service Attention Workflow: This issue is responsible by Azure service team. Mgmt This issue is related to a management-plane library. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels May 29, 2024
@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label May 29, 2024
Copy link

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

@msyyc
Copy link
Member

msyyc commented May 31, 2024

Hi @jartoo, it is by design to filter None when serialization. And Python SDK has a special type NULL of azure.core if you really want to pass null in request payload. Here is example: https://github.com/Azure-Samples/azure-samples-python-management/blob/040589b4a529a228a096e2c6605284fbe7eea495/samples/resources/manage_resource_group_tag.py#L11 and please have a try.

@xiangyan99 xiangyan99 added the needs-author-feedback Workflow: More information is needed from author to address the issue. label May 31, 2024
@github-actions github-actions bot removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label May 31, 2024
Copy link

Hi @jartoo. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

Copy link

Hi @jartoo, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@jartoo
Copy link
Author

jartoo commented Jun 10, 2024

Let me test this, thanks! I missed the NULL type...

@jartoo
Copy link
Author

jartoo commented Jun 10, 2024

It seems when I call the routes.begin_create() using the AzureCoreNull (NULL type per your example) in the azure-mgmt-cdn==13.1.0 module, the _serialization.py key extractor function attribute_key_case_insensitive_extractor() seems to throw an exception when passing it this type. It appears to have three key extractors when I trace the code. This is the second one that throws the exception.

To reproduce:

from azure.identity import DefaultAzureCredential
from azure.mgmt.cdn import CdnManagementClient
from azure.mgmt.cdn.models import Route, RouteUpdateParameters, CompressionSettings, ResourceReference, AfdRouteCacheConfiguration
from azure.core.serialization import NULL as AzureCoreNull

client = CdnManagementClient(credential=DefaultAzureCredential(), subscription_id='xxxxxxx')

cache_configuration = AzureCoreNull
parameters = Route(
    cache_configuration=cache_configuration
)
client.routes.begin_create(
    resource_group_name="myResourceGroup",
    profile_name="myFrontDoor",
    endpoint_name="myEndPoint",
    route_name="myRoute",
    route=parameters
)

Result:
File ".venv/lib/python3.11/site-packages/azure/mgmt/cdn/_serialization.py", line 706, in body
raise SerializationError("Unable to build a model: " + str(err)) from err
azure.core.exceptions.SerializationError: Unable to build a model: Unable to deserialize to object: type

Maybe I am missing something?

@github-actions github-actions bot added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Jun 10, 2024
@msyyc
Copy link
Member

msyyc commented Jun 11, 2024

Let me take a look.

@msyyc
Copy link
Member

msyyc commented Jun 12, 2024

Hi @jartoo Please try again with latest package: https://pypi.org/project/azure-mgmt-cdn/13.1.1/

@jartoo
Copy link
Author

jartoo commented Jun 14, 2024

Will work on this early next week and cycle back with feedback, thanks!!

@xiangyan99 xiangyan99 added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Jun 17, 2024
@github-actions github-actions bot removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jun 17, 2024
Copy link

Hi @jartoo. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

@jartoo
Copy link
Author

jartoo commented Jun 17, 2024

Looks like this issue is resolved in 13.1.1 when testing with the Rules() object. Thanks!

I will cycle back if I see this persist in any other objects. Agree we can close this at this time.

@jartoo jartoo closed this as completed Jun 17, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-author-feedback Workflow: More information is needed from author to address the issue. Network - CDN question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

3 participants