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

Replace \r\n does not work on linux agent #197

Closed
MassimoC opened this issue Jul 16, 2021 · 4 comments · Fixed by #198 or #228
Closed

Replace \r\n does not work on linux agent #197

MassimoC opened this issue Jul 16, 2021 · 4 comments · Fixed by #198 or #228
Assignees
Labels
area:arm All issues related to Azure Resource Manager bug Something isn't working
Milestone

Comments

@MassimoC
Copy link
Contributor

Describe the bug
Replace \r\n does not work on linux agent.
Content injections works fine but I still have the new lines therefore the ARM template is invalid

To Reproduce
Run this one on a linux agent

  • task: PowerShell@2
    inputs:
    targetType: 'inline'
    script: 'Inject-ArmContent -Path "$(System.ArtifactsDirectory)/dashboards"'
    displayName: Inject KQL queries

Expected behavior
A valid ARM template

Additional context
Replace this line

$newString = $newString -replace "`r`n", "\r\n"

with the following code
$newString = $newString -replace "r", "" if ( [environment]::OSVersion.VersionString -like "*Windows*") { $newString = $newString -replace "n", "\r\n"
} else {
$newString = $newString -replace "`n", "\n"
}

@mbraekman mbraekman added area:arm All issues related to Azure Resource Manager bug Something isn't working labels Jul 19, 2021
@mbraekman mbraekman added this to the v0.5.0 milestone Jul 19, 2021
@tomkerkhove
Copy link
Contributor

I'm hitting this one as well

@tomkerkhove tomkerkhove reopened this Oct 7, 2021
@tomkerkhove tomkerkhove self-assigned this Oct 7, 2021
@tomkerkhove
Copy link
Contributor

It didn't work so I'll do a follow-up PR.

@MassimoC
Copy link
Contributor Author

MassimoC commented Oct 7, 2021

It didn't work so I'll do a follow-up PR.

Rollback to the eye-bleeding code that was working 😉

@tomkerkhove
Copy link
Contributor

Rolling forward is easier!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:arm All issues related to Azure Resource Manager bug Something isn't working
Projects
None yet
3 participants