Merge branch 'improve_nfs' of https://github.com/robgjansen/warewulf into robgjansen-improve_nfs

This commit is contained in:
Gregory Kurtzer
2021-12-28 16:27:03 -08:00
4 changed files with 62 additions and 24 deletions

View File

@@ -3,6 +3,7 @@ package warewulfconf
import (
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/creasty/defaults"
)
var ConfigFile = "/etc/warewulf/warewulf.conf"
@@ -43,11 +44,31 @@ type TftpConf struct {
}
type NfsConf struct {
Enabled bool `yaml:"enabled"`
Enabled bool `default:"true" yaml:"enabled"`
Exports []string `yaml:"exports"`
ExportsExtended []*NfsExportConf `yaml:"exports extended"`
SystemdName string `yaml:"systemd name"`
}
func (s *NfsConf) UnmarshalYAML(unmarshal func(interface{}) error) error {
if err := defaults.Set(s); err != nil {
return err
}
type plain NfsConf
if err := unmarshal((*plain)(s)); err != nil {
return err
}
return nil
}
type NfsExportConf struct {
Path string `yaml:"path"`
Options string `yaml:"options"`
Mount bool `yaml:"mount"`
}
func init() {
//TODO: Check to make sure nodes.conf is found
if !util.IsFile(ConfigFile) {