Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/azure-cli/azure/cli/command_modules/resource/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,15 @@ class JsonCTemplatePolicy(SansIOHTTPPolicy):

def on_request(self, request):
http_request = request.http_request
if (getattr(http_request, 'data', {}) or {}).get('properties', {}).get('template'):
request_data = getattr(http_request, 'data', {}) or {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhoxing-ms, have we run all tests impacted by this logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It mainly runs the tests that affects the scope of resource group. The logic of other scopes (such as: tenant sub mg) calling this policy is the same, so the scope of resource group can basically cover all use cases~


# In the case of retry, because the first request has been processed and
# converted the type of "request.http_request.data" from string to bytes,
# so there is no need to process request object again during retry
if isinstance(request_data, bytes):
return

if request_data.get('properties', {}).get('template'):
template = http_request.data["properties"]["template"]
if not isinstance(template, JsonCTemplate):
raise ValueError()
Expand Down
Loading