provisioner/powershell: Remove env var check - we already check in Prepare

This commit is contained in:
DanHam 2017-01-23 10:50:53 +00:00
parent 4514b1b10f
commit 4122f3a897
1 changed files with 5 additions and 14 deletions

View File

@ -331,7 +331,7 @@ func (p *Provisioner) retryable(f func() error) error {
}
}
func (p *Provisioner) createFlattenedEnvVars(elevated bool) (flattened string, err error) {
func (p *Provisioner) createFlattenedEnvVars(elevated bool) (flattened string) {
flattened = ""
envVars := make(map[string]string)
@ -346,11 +346,6 @@ func (p *Provisioner) createFlattenedEnvVars(elevated bool) (flattened string, e
// Split vars into key/value components
for _, envVar := range p.config.Vars {
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]
}
@ -383,10 +378,8 @@ func (p *Provisioner) createCommandText() (command string, err error) {
func (p *Provisioner) createCommandTextNonPrivileged() (command string, err error) {
// Create environment variables to set before executing the command
flattenedEnvVars, err := p.createFlattenedEnvVars(false)
if err != nil {
return "", err
}
flattenedEnvVars := p.createFlattenedEnvVars(false)
p.config.ctx.Data = &ExecuteCommandTemplate{
Vars: flattenedEnvVars,
Path: p.config.RemotePath,
@ -420,10 +413,8 @@ func (p *Provisioner) generateCommandLineRunner(command string) (commandText str
func (p *Provisioner) createCommandTextPrivileged() (command string, err error) {
// Can't double escape the env vars, lets create shiny new ones
flattenedEnvVars, err := p.createFlattenedEnvVars(true)
if err != nil {
return "", err
}
flattenedEnvVars := p.createFlattenedEnvVars(true)
p.config.ctx.Data = &ExecuteCommandTemplate{
Vars: flattenedEnvVars,
Path: p.config.RemotePath,