mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
fix(host-deployer): escape back quote (#19357)
This commit is contained in:
@@ -382,10 +382,11 @@ func (d *QemuKvmDriver) sshRun(cmd string) ([]string, error) {
|
||||
}
|
||||
|
||||
func (d *QemuKvmDriver) sshFilePutContent(params interface{}, filePath string) error {
|
||||
jcontent := jsonutils.Marshal(params)
|
||||
jcontent := jsonutils.Marshal(params).String()
|
||||
jcontent = strings.ReplaceAll(jcontent, "`", "\\`")
|
||||
cmd := fmt.Sprintf(`cat << EOF > %s
|
||||
%s
|
||||
EOF`, filePath, jcontent.String())
|
||||
EOF`, filePath, jcontent)
|
||||
out, err := d.sshRun(cmd)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "sshFilePutContent %s", out)
|
||||
|
||||
Reference in New Issue
Block a user