Commit d705cc5c authored by Yifan Gu's avatar Yifan Gu Committed by Yifan Gu

e2e_node: Disable auto restart on CoreOS.

parent 05951caa
......@@ -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")
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment