Added support for tftp service and updated service interface and config

This commit is contained in:
Gregory Kurtzer
2020-12-04 22:14:29 -08:00
parent 4dff726a36
commit 4efb27a82f
11 changed files with 193 additions and 80 deletions

View File

@@ -224,3 +224,14 @@ func SliceAddUniqueElement(array []string, add string) []string {
return ret
}
func SystemdStart(systemdName string) error {
startCmd := fmt.Sprintf("systemctl restart %s", systemdName)
enableCmd := fmt.Sprintf("systemctl enable %s", systemdName)
wwlog.Printf(wwlog.DEBUG, "Setting up Systemd service: %s\n", systemdName)
ExecInteractive("/bin/sh", "-c", startCmd)
ExecInteractive("/bin/sh", "-c", enableCmd)
return nil
}

View File

@@ -11,7 +11,7 @@ const ConfigFile = "/etc/warewulf/warewulf.conf"
type ControllerConf struct {
Comment string `yaml:"comment"`
Ipaddr string `yaml:"ipaddr"`
Netmask string `yaml:"netmask,omitempty"`
Netmask string `yaml:"netmask"`
Fqdn string `yaml:"fqdn,omitempty"`
Warewulf *WarewulfConf `yaml:"warewulf"`
Dhcp *DhcpConf `yaml:"dhcp"`
@@ -20,35 +20,30 @@ type ControllerConf struct {
}
type WarewulfConf struct {
Port int `yaml:"port,omitempty"`
Secure bool `yaml:"secure,omitempty"`
Enable string `yaml:"enable command,omitempty"`
Restart string `yaml:"restart command,omitempty"`
UpdateInterval int `yaml:"update interval,omitempty"`
Port int `yaml:"port"`
Secure bool `yaml:"secure"`
UpdateInterval int `yaml:"update interval"`
}
type DhcpConf struct {
Enabled bool `yaml:"enabled"`
Template string `yaml:"template,omitempty"`
RangeStart string `yaml:"range start,omitempty"`
RangeEnd string `yaml:"range end,omitempty"`
ConfigFile string `yaml:"config file,omitempty"`
Enable string `yaml:"enable command,omitempty"`
Restart string `yaml:"restart command,omitempty"`
Enabled bool `yaml:"enabled"`
Template string `yaml:"template"`
RangeStart string `yaml:"range start"`
RangeEnd string `yaml:"range end"`
SystemdName string `yaml:"systemd name"`
ConfigFile string `yaml:"config file"`
}
type TftpConf struct {
Enabled bool `yaml:"enabled"`
Root string `yaml:"root,omitempty"`
Enable string `yaml:"enable command,omitempty"`
Restart string `yaml:"restart command,omitempty"`
Enabled bool `yaml:"enabled"`
TftpRoot string `yaml:"tftproot"`
SystemdName string `yaml:"systemd name"`
}
type NfsConf struct {
Enabled bool `yaml:"enabled"`
Exports []string `yaml:"exports,omitempty"`
Enable string `yaml:"enable command,omitempty"`
Restart string `yaml:"restart command,omitempty"`
Enabled bool `yaml:"enabled"`
Exports []string `yaml:"exports"`
SystemdName string `yaml:"systemd name"`
}
func init() {