Merge pull request #4082 from justinsb/unattended_apt_get

Automatic merge from submit-queue.

apt-get: specify unattended installation
This commit is contained in:
Kubernetes Submit Queue 2017-12-15 03:14:37 -08:00 committed by GitHub
commit f0303c80dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -296,9 +296,10 @@ func (_ *Package) RenderLocal(t *local.LocalTarget, a, e, changes *Package) erro
}
} else {
var args []string
env := os.Environ()
if t.HasTag(tags.TagOSFamilyDebian) {
args = []string{"apt-get", "install", "--yes", e.Name}
env = append(env, "DEBIAN_FRONTEND=noninteractive")
} else if t.HasTag(tags.TagOSFamilyRHEL) {
args = []string{"/usr/bin/yum", "install", "-y", e.Name}
} else {
@ -307,6 +308,7 @@ func (_ *Package) RenderLocal(t *local.LocalTarget, a, e, changes *Package) erro
glog.Infof("running command %s", args)
cmd := exec.Command(args[0], args[1:]...)
cmd.Env = env
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("error installing package %q: %v: %s", e.Name, err, string(output))