simplify a bit

This commit is contained in:
Matthew Hooker 2017-09-15 10:06:54 -07:00
parent f71a25c7a7
commit af1187d5e1
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 1 additions and 3 deletions

View File

@ -469,12 +469,10 @@ func (p *Provisioner) generateElevatedRunner(command string) (uploadedPath strin
fmt.Printf("Error creating elevated template: %s", err)
return "", err
}
wrapperBytes := buffer.Bytes()
wrapperReader := bytes.NewReader(wrapperBytes)
uuid := uuid.TimeOrderedUUID()
path := fmt.Sprintf(`${env:TEMP}\packer-elevated-shell-%s.ps1`, uuid)
log.Printf("Uploading elevated shell wrapper for command [%s] to [%s]", command, path)
err = p.communicator.Upload(path, wrapperReader, nil)
err = p.communicator.Upload(path, &buffer, nil)
if err != nil {
return "", fmt.Errorf("Error preparing elevated powershell script: %s", err)
}