mirror of https://github.com/kubernetes/kops.git
apt-get: specify unattended installation
Otherwise we risk getting stuck on a prompt
This commit is contained in:
parent
3a10a8c7cb
commit
78b84d6c2c
|
@ -296,9 +296,10 @@ func (_ *Package) RenderLocal(t *local.LocalTarget, a, e, changes *Package) erro
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var args []string
|
var args []string
|
||||||
|
env := os.Environ()
|
||||||
if t.HasTag(tags.TagOSFamilyDebian) {
|
if t.HasTag(tags.TagOSFamilyDebian) {
|
||||||
args = []string{"apt-get", "install", "--yes", e.Name}
|
args = []string{"apt-get", "install", "--yes", e.Name}
|
||||||
|
env = append(env, "DEBIAN_FRONTEND=noninteractive")
|
||||||
} else if t.HasTag(tags.TagOSFamilyRHEL) {
|
} else if t.HasTag(tags.TagOSFamilyRHEL) {
|
||||||
args = []string{"/usr/bin/yum", "install", "-y", e.Name}
|
args = []string{"/usr/bin/yum", "install", "-y", e.Name}
|
||||||
} else {
|
} else {
|
||||||
|
@ -307,6 +308,7 @@ func (_ *Package) RenderLocal(t *local.LocalTarget, a, e, changes *Package) erro
|
||||||
|
|
||||||
glog.Infof("running command %s", args)
|
glog.Infof("running command %s", args)
|
||||||
cmd := exec.Command(args[0], args[1:]...)
|
cmd := exec.Command(args[0], args[1:]...)
|
||||||
|
cmd.Env = env
|
||||||
output, err := cmd.CombinedOutput()
|
output, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error installing package %q: %v: %s", e.Name, err, string(output))
|
return fmt.Errorf("error installing package %q: %v: %s", e.Name, err, string(output))
|
||||||
|
|
Loading…
Reference in New Issue