-
Notifications
You must be signed in to change notification settings - Fork 3.3k
BatchClient.begin_terminate_job crashes with default value for option parameter #47201
Copy link
Copy link
Open
Labels
customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.needs-triageWorkflow: This is a new issue that needs to be triaged to the appropriate team.Workflow: This is a new issue that needs to be triaged to the appropriate team.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Metadata
Metadata
Assignees
Labels
customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.needs-triageWorkflow: This is a new issue that needs to be triaged to the appropriate team.Workflow: This is a new issue that needs to be triaged to the appropriate team.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Type
Fields
Give feedbackNo fields configured for issues without a type.
Describe the bug
BatchClient.begin_terminate_job()doesn't correctly handle the case where you call it with the default value for theoptionsparameter. It also fails identically with a default-constructedBatchJobTerminateOptionspassed to it. The stack trace is:From this we can determine what the happens to cause this bug:
_terminate_job_internalonly setscontent_typeifoptionsis true (in the bool sense). Neither the default value (None) nor the default-constructedBatchJobTerminateOptionsevaluate to true. Socontent_typeends up equal toNone.build_batch_terminate_job_internal_requestwill always set the content-type header, regardless of if content-type was actually provided (_headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str")). This should be guarded by anifstatement like all of the other headers are.To Reproduce
Steps to reproduce the behavior:
BatchClient.begin_terminate_jobwith the default value foroptions(or with a default constructedBatchJobTerminateOptions).Expected behavior
The default value should work.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.