-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Refine ARMPipelineClient.__init__
#18301
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -52,13 +52,13 @@ def __init__(self, base_url, **kwargs): | |||||||||||
| ) | ||||||||||||
| per_call_policies = kwargs.get('per_call_policies', []) | ||||||||||||
| if isinstance(per_call_policies, Iterable): | ||||||||||||
| per_call_policies.append(ARMAutoResourceProviderRegistrationPolicy()) | ||||||||||||
| per_call_policies = list(per_call_policies).append(ARMAutoResourceProviderRegistrationPolicy()) | ||||||||||||
| else: | ||||||||||||
| per_call_policies = [per_call_policies, | ||||||||||||
| ARMAutoResourceProviderRegistrationPolicy()] | ||||||||||||
| kwargs["per_call_policies"] = per_call_policies | ||||||||||||
| config = kwargs.get('config') | ||||||||||||
| if not config.http_logging_policy: | ||||||||||||
| config.http_logging_policy = kwargs.get('http_logging_policy', ARMHttpLoggingPolicy(**kwargs)) | ||||||||||||
| config.http_logging_policy = ARMHttpLoggingPolicy(**kwargs) | ||||||||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix #18238 (comment) We should forbid the usage of setting
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a clear priority order which is config > kwargs > default one. I would suggest we keeping it because we want to align the priority with others.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, in specific client like Line 76 in 28545a0
Line 59 in 28545a0
Then it is used as the azure-sdk-for-python/sdk/core/azure-mgmt-core/azure/mgmt/core/_pipeline_client.py Lines 61 to 62 in 227c700
So the priority/flow here is more like kwargs > config > default one. Also, since
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In auto generated code (90% of the case), we will generate config which accept http_logging_policy. So http_logging_policy in kwargs works in most of the case except the one in azure-core. |
||||||||||||
| kwargs["config"] = config | ||||||||||||
| super(ARMPipelineClient, self).__init__(base_url, **kwargs) | ||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix #18238 (comment)
appendwill fail ifper_call_policiesis atuple, instead of alist:Convert to
per_call_policiesto alistfirst.