|
|
|
|
@ -15,7 +15,6 @@ import (
|
|
|
|
|
"net"
|
|
|
|
|
"os"
|
|
|
|
|
"os/exec"
|
|
|
|
|
"os/user"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"regexp"
|
|
|
|
|
"strconv"
|
|
|
|
|
@ -122,12 +121,10 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if p.config.User == "" {
|
|
|
|
|
u, err := user.Current()
|
|
|
|
|
if err != nil {
|
|
|
|
|
errs = packer.MultiErrorAppend(errs, err)
|
|
|
|
|
} else {
|
|
|
|
|
p.config.User = u.Username
|
|
|
|
|
}
|
|
|
|
|
p.config.User = os.Getenv("USER")
|
|
|
|
|
}
|
|
|
|
|
if p.config.User == "" {
|
|
|
|
|
errs = packer.MultiErrorAppend(errs, fmt.Errorf("user: could not determine current user from environment."))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if errs != nil && len(errs.Errors) > 0 {
|
|
|
|
|
|