mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-05 05:24:01 +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:
parent
121b8f5338
commit
1f333ea097
@ -119,7 +119,16 @@ func (c *client) ExecuteNodeCommands(ctx context.Context, nodeName string, comma
|
|||||||
|
|
||||||
defer closeOrLogError(sshSession)
|
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 {
|
if err != nil {
|
||||||
return nil, errors.New(string(output))
|
return nil, errors.New(string(output))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user