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

Cherry-pick: Ensure edited scripts provided from the client with newline switches and no other changes get converted to "\n" (#22196) #22202

Merged
merged 1 commit into from
Sep 18, 2024
Merged
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
8 changes: 4 additions & 4 deletions ee/server/service/software_installers.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,16 @@ func (svc *Service) UpdateSoftwareInstaller(ctx context.Context, payload *fleet.

if installScript != existingInstaller.InstallScript {
dirty["InstallScript"] = true
payload.InstallScript = &installScript
}
payload.InstallScript = &installScript
}

if payload.PostInstallScript != nil {
postInstallScript := file.Dos2UnixNewlines(*payload.PostInstallScript)
if postInstallScript != existingInstaller.PostInstallScript {
dirty["PostInstallScript"] = true
payload.PostInstallScript = &postInstallScript
}
payload.PostInstallScript = &postInstallScript
}

if payload.UninstallScript != nil {
Expand All @@ -270,10 +270,10 @@ func (svc *Service) UpdateSoftwareInstaller(ctx context.Context, payload *fleet.

preProcessUninstallScript(payloadForUninstallScript)
if payloadForUninstallScript.UninstallScript != existingInstaller.UninstallScript {
uninstallScript = payloadForUninstallScript.UninstallScript
dirty["UninstallScript"] = true
payload.UninstallScript = &uninstallScript
}
uninstallScript = payloadForUninstallScript.UninstallScript
payload.UninstallScript = &uninstallScript
}

// persist changes starting here, now that we've done all the validation/diffing we can
Expand Down
Loading