provisioner/windows-shell: Remove env var check - again checked in prepare

This commit is contained in:
DanHam 2017-01-23 11:48:20 +00:00
parent c88fafdf38
commit e8db6b9b9a
1 changed files with 2 additions and 9 deletions

View File

@ -207,10 +207,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
defer f.Close() defer f.Close()
// Create environment variables to set before executing the command // Create environment variables to set before executing the command
flattendVars, err := p.createFlattenedEnvVars() flattendVars := p.createFlattenedEnvVars()
if err != nil {
return err
}
// Compile the command // Compile the command
p.config.ctx.Data = &ExecuteCommandTemplate{ p.config.ctx.Data = &ExecuteCommandTemplate{
@ -287,7 +284,7 @@ func (p *Provisioner) retryable(f func() error) error {
} }
} }
func (p *Provisioner) createFlattenedEnvVars() (flattened string, err error) { func (p *Provisioner) createFlattenedEnvVars() (flattened string) {
flattened = "" flattened = ""
envVars := make(map[string]string) envVars := make(map[string]string)
@ -302,10 +299,6 @@ func (p *Provisioner) createFlattenedEnvVars() (flattened string, err error) {
// Split vars into key/value components // Split vars into key/value components
for _, envVar := range p.config.Vars { for _, envVar := range p.config.Vars {
keyValue := strings.SplitN(envVar, "=", 2) keyValue := strings.SplitN(envVar, "=", 2)
if len(keyValue) != 2 || keyValue[0] == "" {
err = errors.New(fmt.Sprintf("Shell provisioner environment variables must be in key=value format. Currently it is '%s'", envVar))
return
}
envVars[keyValue[0]] = keyValue[1] envVars[keyValue[0]] = keyValue[1]
} }
// Create a list of env var keys in sorted order // Create a list of env var keys in sorted order