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

[Automation] RunbookDraftClient.ReplaceContentPreparer sending content as JSON #2350

Closed
hbuckle opened this issue Jul 31, 2018 · 2 comments · Fixed by hashicorp/terraform-provider-azurerm#1696
Assignees

Comments

@hbuckle
Copy link

hbuckle commented Jul 31, 2018

Bug Report

  • import path of package in question - .../services/automation/mgmt/2015-10-31/automation
  • SDK version - 19.1.0
  • output of go version - go1.10.2 windows/amd64

When updating a runbook draft with ReplaceContent the body is being sent as JSON, so line breaks and double quotes are not correctly passed:

PUT https://management.azure.com/subscriptions/xxx/resourceGroups/testytest/providers/Microsoft.Automation/automationAccounts/testytest/runbooks/testy/draft/content?api-version=2015-10-31 HTTP/1.1
Host: management.azure.com
Content-Length: 95
Authorization: Bearer xxx
Content-Type: text/powershell
Accept-Encoding: gzip

"# Comment\r\nWrite-Output \"testing\"\r\nWrite-Output \"more testing\""

Changing autorest.WithJSON to autorest.WithString resolves the issue:

PUT https://management.azure.com/subscriptions/xxx/resourceGroups/testytest/providers/Microsoft.Automation/automationAccounts/testytest/runbooks/testy/draft/content?api-version=2015-10-31 HTTP/1.1
Host: management.azure.com
Content-Length: 85
Authorization: Bearer xxx
Content-Type: text/powershell
Accept-Encoding: gzip

# Comment
Write-Output "testing"
Write-Output "more testing"
@jhendrixMSFT
Copy link
Member

This was fixed in the swagger unfortunately it didn't get merged in time for the v19 release. The fix is already checked into the latest branch and will get rolled out in v20 since it's a breaking change.

@jhendrixMSFT
Copy link
Member

@ghost ghost removed the fix available label Aug 30, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants