Revert "Move configuration code out of wwctl"

This commit is contained in:
Gregory M. Kurtzer
2022-02-11 16:20:05 -08:00
committed by GitHub
parent 5a7f99af18
commit 67ee3bf5f8
33 changed files with 685 additions and 683 deletions

View File

@@ -10,7 +10,6 @@ import (
"os"
"os/exec"
"os/signal"
"path"
"strings"
"syscall"
"time"
@@ -63,10 +62,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
return errors.New("found pidfile " + PIDFile + " not starting")
}
clientDir := buildconfig.WWCLIENTDIR()
testDir := path.Join(clientDir, "wwclient-test")
if os.Args[0] == path.Join(clientDir, "wwclient") {
if os.Args[0] == buildconfig.WWCLIENTLOC() {
err := os.Chdir("/")
if err != nil {
wwlog.Printf(wwlog.ERROR, "failed to change dir: %s", err)
@@ -77,15 +73,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
time.Sleep(5000 * time.Millisecond)
} else {
fmt.Printf("Called via: %s\n", os.Args[0])
fmt.Printf("Runtime overlay is being put in '%s' rather than '/'\n", testDir)
err := os.MkdirAll(testDir, 0755)
fmt.Printf("Runtime overlay is being put in '/warewulf/wwclient-test' rather than '/'\n")
err := os.MkdirAll("/warewulf/wwclient-test", 0755)
if err != nil {
wwlog.Printf(wwlog.ERROR, "failed to create dir: %s", err)
_ = os.Remove(PIDFile)
os.Exit(1)
}
err = os.Chdir(testDir)
err = os.Chdir("/warewulf/wwclient-test")
if err != nil {
wwlog.Printf(wwlog.ERROR, "failed to change dir: %s", err)
_ = os.Remove(PIDFile)