e2e_node: Disable auto restart on CoreOS.

pull/6/head
Yifan Gu 2016-04-29 18:25:10 -07:00 committed by Yifan Gu
parent 05951caa44
commit d705cc5cf8
1 changed files with 19 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"math/rand"
"os/exec"
"strings"
@ -65,6 +66,11 @@ var _ = BeforeSuite(func() {
*nodeName = strings.TrimSpace(fmt.Sprintf("%s", output))
}
// TODO(yifan): Temporary workaround to disable coreos from auto restart
// by masking the locksmithd.
// We should mask locksmithd when provisioning the machine.
maskLocksmithdOnCoreos()
if *startServices {
e2es = newE2eService(*nodeName)
if err := e2es.start(); err != nil {
@ -118,3 +124,16 @@ func (lr *LogReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) {
b.WriteString("******************************************************\n")
glog.Infof(b.String())
}
func maskLocksmithdOnCoreos() {
data, err := ioutil.ReadFile("/etc/os-release")
if err != nil {
glog.Fatalf("Could not read /etc/os-release: %v", err)
}
if bytes.Contains(data, []byte("ID=coreos")) {
if output, err := exec.Command("sudo", "systemctl", "mask", "--now", "locksmithd").CombinedOutput(); err != nil {
glog.Fatalf("Could not mask locksmithd: %v, output: %q", err, string(output))
}
}
glog.Infof("Locksmithd is masked successfully")
}