0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-04 21:14:05 +00:00

fix(vm): error when creating custom disks on PVE with non-default shell (#983)

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
Pavel Boldyrev 2024-01-28 12:13:43 -05:00 committed by GitHub
parent 121b8f5338
commit 1f333ea097
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -119,7 +119,16 @@ func (c *client) ExecuteNodeCommands(ctx context.Context, nodeName string, comma
defer closeOrLogError(sshSession)
output, err := sshSession.CombinedOutput(strings.Join(commands, "; "))
script := strings.Join(commands, "; ")
output, err := sshSession.CombinedOutput(
fmt.Sprintf(
// explicitly use bash to support shell features like pipes and var assignment
"/bin/bash -c '%s'",
// shell script escaping for single quotes
strings.ReplaceAll(script, `'`, `'"'"'`),
),
)
if err != nil {
return nil, errors.New(string(output))
}