Merge pull request #2229 from mitchellh/b-shell-quote
provisioner/shell: escape single quotes [GH-2067]
This commit is contained in:
commit
08863626af
|
@ -145,6 +145,9 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
|
||||||
errs = packer.MultiErrorAppend(errs,
|
errs = packer.MultiErrorAppend(errs,
|
||||||
fmt.Errorf("Environment variable not in format 'key=value': %s", kv))
|
fmt.Errorf("Environment variable not in format 'key=value': %s", kv))
|
||||||
} else {
|
} else {
|
||||||
|
// Replace single quotes so they parse
|
||||||
|
vs[1] = strings.Replace(vs[1], "'", `'"'"'`, -1)
|
||||||
|
|
||||||
// Single quote env var values
|
// Single quote env var values
|
||||||
p.config.Vars[idx] = fmt.Sprintf("%s='%s'", vs[0], vs[1])
|
p.config.Vars[idx] = fmt.Sprintf("%s='%s'", vs[0], vs[1])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue