diff --git a/CHANGELOG.md b/CHANGELOG.md index 447dc271..af1360f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -149,6 +149,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - move hostlist into internal alongside other warewulf code #804 - uniform shebang usage in scripts of init.d folder #821 - Check if commas are allowes in node/profile set +- Removed paths.tftpdir and paths.datadir ## [4.4.0] 2023-01-18 diff --git a/internal/pkg/config/buildconfig.go.in b/internal/pkg/config/buildconfig.go.in index 125f192f..bfa771f1 100644 --- a/internal/pkg/config/buildconfig.go.in +++ b/internal/pkg/config/buildconfig.go.in @@ -5,11 +5,9 @@ var ConfigFile = "@SYSCONFDIR@/warewulf/warewulf.conf" type BuildConfig struct { Bindir string `default:"@BINDIR@"` Sysconfdir string `default:"@SYSCONFDIR@"` - Datadir string `default:"@DATADIR@"` Localstatedir string `default:"@LOCALSTATEDIR@"` Ipxesource string `default:"@IPXESOURCE@"` Srvdir string `default:"@SRVDIR@"` - Tftpdir string `default:"@TFTPDIR@"` Firewallddir string `default:"@FIREWALLDDIR@"` Systemddir string `default:"@SYSTEMDDIR@"` WWOverlaydir string `default:"@WWOVERLAYDIR@"` @@ -19,3 +17,22 @@ type BuildConfig struct { Release string `default:"@RELEASE@"` WWClientdir string `default:"@WWCLIENTDIR@"` } +type TFTPConf struct { + Enabled bool `yaml:"enabled" default:"true"` + TftpRoot string `yaml:"tftproot" default:"@TFTPDIR@"` + SystemdName string `yaml:"systemd name" default:"tftp"` + + IpxeBinaries map[string]string `yaml:"ipxe" default:"{\"00:09\": \"ipxe-snponly-x86_64.efi\",\"00:00\": \"undionly.kpxe\",\"00:0B\": \"arm64-efi/snponly.efi\",\"00:07\": \"ipxe-snponly-x86_64.efi\"}"` +} +// WarewulfConf adds additional Warewulf-specific configuration to +// BaseConf. +type WarewulfConf struct { + Port int `yaml:"port" default:"9983"` + Secure bool `yaml:"secure" default:"true"` + UpdateInterval int `yaml:"update interval" default:"60"` + AutobuildOverlays bool `yaml:"autobuild overlays" default:"true"` + EnableHostOverlay bool `yaml:"host overlay" default:"true"` + Syslog bool `yaml:"syslog" default:"false"` + DataStore string `yaml:"datastore" default:"@DATADIR@"` + GrubBoot bool `yaml:"grubboot" default:"false"` +} diff --git a/internal/pkg/config/mounts.go b/internal/pkg/config/mounts.go index daf38c0a..2eb5060b 100644 --- a/internal/pkg/config/mounts.go +++ b/internal/pkg/config/mounts.go @@ -3,8 +3,8 @@ package config // A MountEntry represents a bind mount that is applied to a container // during exec and shell. type MountEntry struct { - Source string `yaml:"source" default:"/etc/resolv.conf"` - Dest string `yaml:"dest,omitempty" default:"/etc/resolv.conf"` - ReadOnly bool `yaml:"readonly,omitempty" default:"false"` + Source string `yaml:"source"` + Dest string `yaml:"dest,omitempty"` + ReadOnly bool `yaml:"readonly,omitempty"` Options string `yaml:"options,omitempty"` // ignored at the moment } diff --git a/internal/pkg/config/root_test.go b/internal/pkg/config/root_test.go index f8c9a697..d57d1557 100644 --- a/internal/pkg/config/root_test.go +++ b/internal/pkg/config/root_test.go @@ -43,10 +43,9 @@ func TestDefaultRootConf(t *testing.T) { assert.NotEmpty(t, conf.Paths.Bindir) assert.NotEmpty(t, conf.Paths.Sysconfdir) - assert.NotEmpty(t, conf.Paths.Datadir) + assert.NotEmpty(t, conf.Warewulf.DataStore) assert.NotEmpty(t, conf.Paths.Localstatedir) assert.NotEmpty(t, conf.Paths.Srvdir) - assert.NotEmpty(t, conf.Paths.Tftpdir) assert.NotEmpty(t, conf.Paths.Firewallddir) assert.NotEmpty(t, conf.Paths.Systemddir) assert.NotEmpty(t, conf.Paths.WWOverlaydir) diff --git a/internal/pkg/config/tftp.go b/internal/pkg/config/tftp.go deleted file mode 100644 index cd5260df..00000000 --- a/internal/pkg/config/tftp.go +++ /dev/null @@ -1,11 +0,0 @@ -package config - -// TFTPConf represents that configuration for the TFTP service that -// Warewulf will configure. -type TFTPConf struct { - Enabled bool `yaml:"enabled" default:"true"` - TftpRoot string `yaml:"tftproot" default:"/var/lib/tftpboot"` - SystemdName string `yaml:"systemd name" default:"tftp"` - - IpxeBinaries map[string]string `yaml:"ipxe" default:"{\"00:09\": \"ipxe-snponly-x86_64.efi\",\"00:00\": \"undionly.kpxe\",\"00:0B\": \"arm64-efi/snponly.efi\",\"00:07\": \"ipxe-snponly-x86_64.efi\"}"` -} diff --git a/internal/pkg/config/warewulf.go b/internal/pkg/config/warewulf.go deleted file mode 100644 index 9a0dc3f4..00000000 --- a/internal/pkg/config/warewulf.go +++ /dev/null @@ -1,14 +0,0 @@ -package config - -// WarewulfConf adds additional Warewulf-specific configuration to -// BaseConf. -type WarewulfConf struct { - Port int `yaml:"port" default:"9983"` - Secure bool `yaml:"secure" default:"true"` - UpdateInterval int `yaml:"update interval" default:"60"` - AutobuildOverlays bool `yaml:"autobuild overlays" default:"true"` - EnableHostOverlay bool `yaml:"host overlay" default:"true"` - Syslog bool `yaml:"syslog" default:"false"` - DataStore string `yaml:"datastore" default:"/var/lib/warewulf"` - GrubBoot bool `yaml:"grubboot" default:"false"` -} diff --git a/internal/pkg/configure/tftp.go b/internal/pkg/configure/tftp.go index cce8249c..06d31752 100644 --- a/internal/pkg/configure/tftp.go +++ b/internal/pkg/configure/tftp.go @@ -12,7 +12,7 @@ import ( func TFTP() error { controller := warewulfconf.Get() - var tftpdir string = path.Join(controller.Paths.Tftpdir, "warewulf") + var tftpdir string = path.Join(controller.TFTP.TftpRoot, "warewulf") err := os.MkdirAll(tftpdir, 0755) if err != nil { diff --git a/internal/pkg/node/constructors.go b/internal/pkg/node/constructors.go index 03ce2401..609a53ea 100644 --- a/internal/pkg/node/constructors.go +++ b/internal/pkg/node/constructors.go @@ -49,7 +49,7 @@ func New() (NodeYaml, error) { ConfigFile = path.Join(conf.Paths.Sysconfdir, "warewulf/nodes.conf") } if DefaultConfig == "" { - DefaultConfig = path.Join(conf.Paths.Datadir, "warewulf/defaults.conf") + DefaultConfig = path.Join(conf.Warewulf.DataStore, "warewulf/defaults.conf") } wwlog.Verbose("Opening node configuration file: %s", ConfigFile) data, err := os.ReadFile(ConfigFile) diff --git a/internal/pkg/testenv/testenv.go b/internal/pkg/testenv/testenv.go index 44020c1a..4e4d9169 100644 --- a/internal/pkg/testenv/testenv.go +++ b/internal/pkg/testenv/testenv.go @@ -68,10 +68,10 @@ func New(t *testing.T) (env *TestEnv) { conf.Paths.Sysconfdir = env.GetPath(Sysconfdir) conf.Paths.Bindir = env.GetPath(Bindir) - conf.Paths.Datadir = env.GetPath(Datadir) + conf.Warewulf.DataStore = env.GetPath(Datadir) conf.Paths.Localstatedir = env.GetPath(Localstatedir) conf.Paths.Srvdir = env.GetPath(Srvdir) - conf.Paths.Tftpdir = env.GetPath(Tftpdir) + conf.TFTP.TftpRoot = env.GetPath(Tftpdir) conf.Paths.Firewallddir = env.GetPath(Firewallddir) conf.Paths.Systemddir = env.GetPath(Systemddir) conf.Paths.WWOverlaydir = env.GetPath(WWOverlaydir) @@ -82,10 +82,10 @@ func New(t *testing.T) (env *TestEnv) { for _, confPath := range []string{ conf.Paths.Sysconfdir, conf.Paths.Bindir, - conf.Paths.Datadir, + conf.Warewulf.DataStore, conf.Paths.Localstatedir, conf.Paths.Srvdir, - conf.Paths.Tftpdir, + conf.TFTP.TftpRoot, conf.Paths.Firewallddir, conf.Paths.Systemddir, conf.Paths.WWOverlaydir,