removed doubled entries form conf.Path

tftp.tftproot was also avlailable under paths.tftdir, removed
paths.tftpdir

warewulfconf.datastore was also availbale under
paths.datadir, remove paths.datadir

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2024-01-15 14:13:00 +01:00
committed by Jonathon Anderson
parent 58069cfb13
commit 24cb00e068
9 changed files with 30 additions and 38 deletions

View File

@@ -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

View File

@@ -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"`
}

View File

@@ -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
}

View File

@@ -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)

View File

@@ -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\"}"`
}

View File

@@ -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"`
}

View File

@@ -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 {

View File

@@ -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)

View File

@@ -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,