Convert disk booleans from wwbool to *bool

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2025-09-02 19:43:02 -06:00
committed by Christian Goll
parent cc946e0b99
commit 59f187bf5e
23 changed files with 216 additions and 101 deletions

View File

@@ -4,6 +4,7 @@ import (
"net"
"github.com/creasty/defaults"
"github.com/warewulf/warewulf/internal/pkg/util"
)
type IPNet net.IPNet
@@ -46,5 +47,5 @@ func (conf *APIConf) Unmarshal(unmarshal func(interface{}) error) error {
}
func (conf APIConf) Enabled() bool {
return BoolP(conf.EnabledP)
return util.BoolP(conf.EnabledP)
}

View File

@@ -1,6 +1,7 @@
package config
import (
"github.com/warewulf/warewulf/internal/pkg/util"
"path"
)
@@ -34,7 +35,7 @@ type TFTPConf struct {
}
func (conf TFTPConf) Enabled() bool {
return BoolP(conf.EnabledP)
return util.BoolP(conf.EnabledP)
}
// WarewulfConf adds additional Warewulf-specific configuration to
@@ -50,19 +51,19 @@ type WarewulfConf struct {
}
func (conf WarewulfConf) Secure() bool {
return BoolP(conf.SecureP)
return util.BoolP(conf.SecureP)
}
func (conf WarewulfConf) AutobuildOverlays() bool {
return BoolP(conf.AutobuildOverlaysP)
return util.BoolP(conf.AutobuildOverlaysP)
}
func (conf WarewulfConf) EnableHostOverlay() bool {
return BoolP(conf.EnableHostOverlayP)
return util.BoolP(conf.EnableHostOverlayP)
}
func (conf WarewulfConf) GrubBoot() bool {
return BoolP(conf.GrubBootP)
return util.BoolP(conf.GrubBootP)
}
func (paths BuildConfig) NodesConf() string {

View File

@@ -1,5 +1,9 @@
package config
import (
"github.com/warewulf/warewulf/internal/pkg/util"
)
// DHCPConf represents the configuration for the DHCP service that
// Warewulf will configure.
type DHCPConf struct {
@@ -11,5 +15,5 @@ type DHCPConf struct {
}
func (conf DHCPConf) Enabled() bool {
return BoolP(conf.EnabledP)
return util.BoolP(conf.EnabledP)
}

View File

@@ -1,5 +1,9 @@
package config
import (
"github.com/warewulf/warewulf/internal/pkg/util"
)
// A MountEntry represents a bind mount that is applied to an image
// during exec and shell.
type MountEntry struct {
@@ -11,9 +15,9 @@ type MountEntry struct {
}
func (mount MountEntry) ReadOnly() bool {
return BoolP(mount.ReadOnlyP)
return util.BoolP(mount.ReadOnlyP)
}
func (mount MountEntry) Copy() bool {
return BoolP(mount.CopyP)
return util.BoolP(mount.CopyP)
}

View File

@@ -2,6 +2,7 @@ package config
import (
"github.com/creasty/defaults"
"github.com/warewulf/warewulf/internal/pkg/util"
)
// NFSConf represents the NFS configuration that will be used by
@@ -14,7 +15,7 @@ type NFSConf struct {
}
func (conf NFSConf) Enabled() bool {
return BoolP(conf.EnabledP)
return util.BoolP(conf.EnabledP)
}
// An NFSExportConf reprents a single NFS export / mount.

View File

@@ -5,10 +5,6 @@ import (
"net"
)
func BoolP(p *bool) bool {
return p != nil && *p
}
func GetOutboundIP() net.IP {
conn, err := net.Dial("udp", "192.0.2.1:80")
if err != nil {