From c549fce85e9e09be6c072bfdbc44a430219663b1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 13 Jun 2015 14:11:20 -0400 Subject: [PATCH] provisioner/shell: escape single quotes [GH-2067] --- provisioner/shell/provisioner.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/provisioner/shell/provisioner.go b/provisioner/shell/provisioner.go index 212ec2abf..baedd645a 100644 --- a/provisioner/shell/provisioner.go +++ b/provisioner/shell/provisioner.go @@ -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]) }