diff --git a/CHANGELOG.md b/CHANGELOG.md index 79f4eb1b..926aa712 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Add flag `--build` to `wwctl container copy`. #1378 - Add `wwctl clean` to remove OCI cache and overlays from deleted nodes - Add `wwctl container import --platform`. #1381 +- Read environment variables from `/etc/default/warewulfd` #725 ### Changed @@ -46,6 +47,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Updated various shell scripts for POSIX compatibility. #1464 - Update `wwctl server` to always run in the foreground #508 - Update `wwctl server` to log to stdout rather than a file #503 +- Changed `wwctl server` to use "INFO" for send and receive logs #725 ### Removed diff --git a/include/systemd/warewulfd.service.in b/include/systemd/warewulfd.service.in index 6ba38606..249f370a 100644 --- a/include/systemd/warewulfd.service.in +++ b/include/systemd/warewulfd.service.in @@ -6,6 +6,7 @@ AssertFileIsExecutable=@BINDIR@/wwctl [Service] Type=exec +EnvironmentFile=-/etc/default/warewulfd User=root Group=root ExecStart=@BINDIR@/wwctl server diff --git a/internal/pkg/warewulfd/daemon.go b/internal/pkg/warewulfd/daemon.go index e595f509..b60563a5 100644 --- a/internal/pkg/warewulfd/daemon.go +++ b/internal/pkg/warewulfd/daemon.go @@ -53,7 +53,7 @@ func DaemonInitLogging() error { wwlog.SetLogLevel(level) } } else { - wwlog.SetLogLevel(wwlog.SERV) + wwlog.SetLogLevel(wwlog.INFO) } conf := warewulfconf.Get() diff --git a/internal/pkg/warewulfd/provision.go b/internal/pkg/warewulfd/provision.go index 0ccf5eea..9426e067 100644 --- a/internal/pkg/warewulfd/provision.go +++ b/internal/pkg/warewulfd/provision.go @@ -48,7 +48,7 @@ func ProvisionSend(w http.ResponseWriter, req *http.Request) { return } - wwlog.Recv("hwaddr: %s, ipaddr: %s, stage: %s", rinfo.hwaddr, req.RemoteAddr, rinfo.stage) + wwlog.Info("request from hwaddr:%s ipaddr:%s | stage:%s", rinfo.hwaddr, req.RemoteAddr, rinfo.stage) if (rinfo.stage == "runtime" || len(rinfo.overlay) > 0) && conf.Warewulf.Secure { if rinfo.remoteport >= 1024 { @@ -276,7 +276,7 @@ func ProvisionSend(w http.ResponseWriter, req *http.Request) { wwlog.ErrorExc(err, "") } - wwlog.Send("%15s: %s", remoteNode.Id(), stage_file) + wwlog.Info("send %s -> %s", stage_file, remoteNode.Id()) } else { if rinfo.compress == "gz" { diff --git a/internal/pkg/warewulfd/util.go b/internal/pkg/warewulfd/util.go index 24008622..0ba04921 100644 --- a/internal/pkg/warewulfd/util.go +++ b/internal/pkg/warewulfd/util.go @@ -39,7 +39,7 @@ func sendFile( stat.ModTime(), fd) - wwlog.Send("%15s: %s", sendto, filename) + wwlog.Info("send %s -> %s", filename, sendto) req.Body.Close() return nil } diff --git a/internal/pkg/wwlog/wwlog.go b/internal/pkg/wwlog/wwlog.go index bd8b6179..284c2950 100644 --- a/internal/pkg/wwlog/wwlog.go +++ b/internal/pkg/wwlog/wwlog.go @@ -37,8 +37,6 @@ var ( SECWARN = SetLevelName(31, "SECWARN") WARN = SetLevelName(30, "WARN") ERROUT = SetLevelName(29, "ERROUT") - SEND = SetLevelName(27, "SEND") - RECV = SetLevelName(26, "RECV") SERV = SetLevelName(25, "SERV") OUT = SetLevelName(22, "OUT") SECINFO = SetLevelName(21, "SECINFO") @@ -206,7 +204,7 @@ func LogCaller(level int, skip int, err error, message string, a ...interface{}) } message = logFormatter(logLevel, &rec) - if level == INFO || level == RECV || level == SEND || level == OUT { + if level == INFO || level == OUT { fmt.Fprint(logOut, message) } else { fmt.Fprint(logErr, message) @@ -271,14 +269,6 @@ func Serv(message string, a ...interface{}) { LogCaller(SERV, 1, nil, message, a...) } -func Recv(message string, a ...interface{}) { - LogCaller(RECV, 1, nil, message, a...) -} - -func Send(message string, a ...interface{}) { - LogCaller(SEND, 1, nil, message, a...) -} - func Warn(message string, a ...interface{}) { LogCaller(WARN, 1, nil, message, a...) } diff --git a/internal/pkg/wwlog/wwlog_test.go b/internal/pkg/wwlog/wwlog_test.go index 72d61899..1c0ed4ed 100644 --- a/internal/pkg/wwlog/wwlog_test.go +++ b/internal/pkg/wwlog/wwlog_test.go @@ -126,20 +126,6 @@ func Test_Log(t *testing.T) { expect: "SERV : Serv\n", exactMatch: true, }, - { - name: "Recv", - msgTypeFunc: Recv, - message: "Recv", - expect: "RECV : Recv\n", - exactMatch: true, - }, - { - name: "Send", - msgTypeFunc: Send, - message: "Send", - expect: "SEND : Send\n", - exactMatch: true, - }, { name: "Warn", msgTypeFunc: Warn,