added a test for wwctl node add
Signed-off-by: Christian Goll <cgoll@suse.de>
This commit is contained in:
@@ -23,6 +23,23 @@ const (
|
||||
|
||||
var loginit bool
|
||||
|
||||
// allow to run without daemon for tests
|
||||
var nodaemon bool
|
||||
|
||||
func init() {
|
||||
nodaemon = false
|
||||
}
|
||||
|
||||
// run without daemon
|
||||
func SetNoDaemon() {
|
||||
nodaemon = true
|
||||
}
|
||||
|
||||
// run with daemon
|
||||
func SetDaemon() {
|
||||
nodaemon = false
|
||||
}
|
||||
|
||||
func DaemonFormatter(logLevel int, rec *wwlog.LogRecord) string {
|
||||
return "[" + rec.Time.Format(time.UnixDate) + "] " + wwlog.DefaultFormatter(logLevel, rec)
|
||||
}
|
||||
@@ -66,6 +83,10 @@ func DaemonInitLogging() error {
|
||||
}
|
||||
|
||||
func DaemonStart() error {
|
||||
if nodaemon {
|
||||
return nil
|
||||
}
|
||||
|
||||
if os.Getenv("WAREWULFD_BACKGROUND") == "1" {
|
||||
err := RunServer()
|
||||
if err != nil {
|
||||
@@ -116,6 +137,10 @@ func DaemonStart() error {
|
||||
}
|
||||
|
||||
func DaemonStatus() error {
|
||||
if nodaemon {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !util.IsFile(WAREWULFD_PIDFILE) {
|
||||
return errors.New("Warewulf server is not running")
|
||||
}
|
||||
@@ -142,6 +167,9 @@ func DaemonStatus() error {
|
||||
}
|
||||
|
||||
func DaemonReload() error {
|
||||
if nodaemon {
|
||||
return nil
|
||||
}
|
||||
if !util.IsFile(WAREWULFD_PIDFILE) {
|
||||
return errors.New("Warewulf server is not running")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user