Merge pull request #2229 from mitchellh/b-shell-quote

provisioner/shell: escape single quotes [GH-2067]
This commit is contained in:
Mitchell Hashimoto 2015-06-15 09:37:30 -07:00
commit 08863626af
1 changed files with 3 additions and 0 deletions

View File

@ -145,6 +145,9 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
errs = packer.MultiErrorAppend(errs,
fmt.Errorf("Environment variable not in format 'key=value': %s", kv))
} else {
// Replace single quotes so they parse
vs[1] = strings.Replace(vs[1], "'", `'"'"'`, -1)
// Single quote env var values
p.config.Vars[idx] = fmt.Sprintf("%s='%s'", vs[0], vs[1])
}