|
|
|
|
@ -377,7 +377,7 @@ func (p *Provisioner) createFlattenedEnvVars(elevated bool) (flattened string) {
|
|
|
|
|
|
|
|
|
|
// interpolate environment variables
|
|
|
|
|
p.config.ctx.Data = &EnvVarsTemplate{
|
|
|
|
|
WinRMPassword: getWinRMPassword(),
|
|
|
|
|
WinRMPassword: getWinRMPassword(p.config.PackerBuildName),
|
|
|
|
|
}
|
|
|
|
|
// Split vars into key/value components
|
|
|
|
|
for _, envVar := range p.config.Vars {
|
|
|
|
|
@ -445,7 +445,7 @@ func (p *Provisioner) createCommandTextNonPrivileged() (command string, err erro
|
|
|
|
|
p.config.ctx.Data = &ExecuteCommandTemplate{
|
|
|
|
|
Path: p.config.RemotePath,
|
|
|
|
|
Vars: envVarPath,
|
|
|
|
|
WinRMPassword: getWinRMPassword(),
|
|
|
|
|
WinRMPassword: getWinRMPassword(p.config.PackerBuildName),
|
|
|
|
|
}
|
|
|
|
|
command, err = interpolate.Render(p.config.ExecuteCommand, &p.config.ctx)
|
|
|
|
|
|
|
|
|
|
@ -457,8 +457,8 @@ func (p *Provisioner) createCommandTextNonPrivileged() (command string, err erro
|
|
|
|
|
return command, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getWinRMPassword() string {
|
|
|
|
|
winRMPass, _ := commonhelper.RetrieveSharedState("winrm_password")
|
|
|
|
|
func getWinRMPassword(buildName string) string {
|
|
|
|
|
winRMPass, _ := commonhelper.RetrieveSharedState("winrm_password", buildName)
|
|
|
|
|
return winRMPass
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -472,7 +472,7 @@ func (p *Provisioner) createCommandTextPrivileged() (command string, err error)
|
|
|
|
|
p.config.ctx.Data = &ExecuteCommandTemplate{
|
|
|
|
|
Path: p.config.RemotePath,
|
|
|
|
|
Vars: envVarPath,
|
|
|
|
|
WinRMPassword: getWinRMPassword(),
|
|
|
|
|
WinRMPassword: getWinRMPassword(p.config.PackerBuildName),
|
|
|
|
|
}
|
|
|
|
|
command, err = interpolate.Render(p.config.ElevatedExecuteCommand, &p.config.ctx)
|
|
|
|
|
if err != nil {
|
|
|
|
|
@ -530,7 +530,7 @@ func (p *Provisioner) generateElevatedRunner(command string) (uploadedPath strin
|
|
|
|
|
}
|
|
|
|
|
// Replace ElevatedPassword for winrm users who used this feature
|
|
|
|
|
p.config.ctx.Data = &EnvVarsTemplate{
|
|
|
|
|
WinRMPassword: getWinRMPassword(),
|
|
|
|
|
WinRMPassword: getWinRMPassword(p.config.PackerBuildName),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p.config.ElevatedPassword, _ = interpolate.Render(p.config.ElevatedPassword, &p.config.ctx)
|
|
|
|
|
|