Add config option for shared state dir

Signed-off-by: jcsiadal <jeremy.c.siadal@intel.com>

Changes default share to /srv/warewulf
Update specfile
Some changes to match Golang standards
This commit is contained in:
jcsiadal
2021-12-14 04:37:39 +00:00
parent 72290a3a3d
commit 8e626e9a62
18 changed files with 229 additions and 80 deletions

View File

@@ -10,6 +10,13 @@ ifeq ($(VERSION_FULL),)
VERSION_FULL := $(VERSION)
endif
WWROOT ?= /var/lib
# warewulf subdir automatcally added to TFTPROOT
TFTPROOT ?= /var/lib/tftpboot
# SUSE: TFTPROOT ?= /srv/tftpboot
# Ubuntu: TFTPROOT ?= /srv/tftp
FIREWALLDIR ?= /usr/lib/firewalld/services
OVERLAYDIR ?= $(WWROOT)/warewulf/overlays
# auto installed tooling
TOOLS_DIR := .tools
@@ -29,8 +36,7 @@ export GOPROXY
# built tags needed for wwbuild binary
WW_BUILD_GO_BUILD_TAGS := containers_image_openpgp containers_image_ostree
# all build targets
all: vendor wwctl wwclient bash_completion.d man_pages
all: config vendor wwctl wwclient bash_completion.d man_pages
build: lint test-it vet all
@@ -46,7 +52,7 @@ $(GOLANGCI_LINT):
@curl -qq -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_BIN) $(GOLANGCI_LINT_VERSION)
setup: vendor $(TOOLS_DIR) setup_tools
setup: vendor $(TOOLS_DIR) setup_tools config
# vendor
vendor:
@@ -56,8 +62,13 @@ vendor:
$(TOOLS_DIR):
@mkdir -p $@
# Pre-build steps for source, such as "go generate"
config:
sed -e 's,@WWROOT@,$(WWROOT),g; s,@VERSION@,$(VERSION),g; s,@RELEASE@,$(RELEASE),g' warewulf.spec.in > warewulf.spec
sed -e 's,@WWROOT@,$(WWROOT),g; s,@TFTPROOT@,$(TFTPROOT),g' etc/warewulf.conf.in > etc/warewulf.conf
# Lint
lint: setup_tools
lint: setup_tools config
@echo Running golangci-lint...
@$(GOLANGCI_LINT) run --build-tags "$(WW_BUILD_GO_BUILD_TAGS)" --skip-dirs internal/pkg/staticfiles ./...
@@ -81,11 +92,12 @@ debian: all
files: all
install -d -m 0755 $(DESTDIR)/usr/bin/
install -d -m 0755 $(DESTDIR)/var/warewulf/
install -d -m 0755 $(DESTDIR)/var/warewulf/chroots
install -d -m 0755 $(DESTDIR)$(WWROOT)/warewulf/
install -d -m 0755 $(DESTDIR)$(WWROOT)/warewulf/chroots
install -d -m 0755 $(DESTDIR)$(WWROOT)/warewulf/provision
install -d -m 0755 $(DESTDIR)/etc/warewulf/
install -d -m 0755 $(DESTDIR)/etc/warewulf/ipxe
install -d -m 0755 $(DESTDIR)/var/lib/tftpboot/warewulf/ipxe/
install -d -m 0755 $(DESTDIR)$(TFTPROOT)/warewulf/ipxe/
install -d -m 0755 $(DESTDIR)/etc/bash_completion.d/
install -d -m 0755 $(DESTDIR)/usr/share/man/man1
test -f $(DESTDIR)/etc/warewulf/warewulf.conf || install -m 644 etc/warewulf.conf $(DESTDIR)/etc/warewulf/
@@ -94,15 +106,25 @@ files: all
cp -r etc/dhcp $(DESTDIR)/etc/warewulf/
cp -r etc/ipxe $(DESTDIR)/etc/warewulf/
cp -r overlays $(DESTDIR)/var/warewulf/
mkdir -p $(DESTDIR)/var/warewulf/overlays/wwinit/bin/
mkdir -p $(DESTDIR)/var/warewulf/overlays/wwinit/warewulf/bin/
chmod +x $(DESTDIR)/var/warewulf/overlays/wwinit/init
chmod 600 $(DESTDIR)/var/warewulf/overlays/wwinit/etc/ssh/ssh*
chmod 644 $(DESTDIR)/var/warewulf/overlays/wwinit/etc/ssh/ssh*.pub.ww
mkdir -p $(DESTDIR)/var/warewulf/overlays/wwinit/warewulf/bin/
mkdir -p $(DESTDIR)$(OVERLAYIR)/wwinit/bin/
mkdir -p $(DESTDIR)$(OVERLAYIR)/wwinit/warewulf/bin/
chmod +x $(DESTDIR)$(OVERLAYIR)/wwinit/init
chmod 600 $(DESTDIR)$(OVERLAYIR)/wwinit/etc/ssh/ssh*
chmod 644 $(DESTDIR)$(OVERLAYIR)/wwinit/etc/ssh/ssh*.pub.ww
mkdir -p $(DESTDIR)$(OVERLAYIR)/wwinit/warewulf/bin/
install -m 0755 wwctl $(DESTDIR)/usr/bin/
mkdir -p $(DESTDIR)/usr/lib/firewalld/services
install -c -m 0644 include/firewalld/warewulf.xml $(DESTDIR)/usr/lib/firewalld/services
cp -r overlays $(DESTDIR)$(WWROOT)/warewulf/
mkdir -p $(DESTDIR)$(OVERLAYIR)/wwinit/bin/
mkdir -p $(DESTDIR)$(OVERLAYIR)/wwinit/warewulf/bin/
chmod +x $(DESTDIR)$(OVERLAYIR)/wwinit/init
chmod 600 $(DESTDIR)$(OVERLAYIR)/wwinit/etc/ssh/ssh*
chmod 644 $(DESTDIR)$(OVERLAYIR)/wwinit/etc/ssh/ssh*.pub.ww
mkdir -p $(DESTDIR)$(OVERLAYIR)/wwinit/warewulf/bin/
install -m 0755 wwctl $(DESTDIR)/usr/bin/
mkdir -p $(DESTDIR)$(FIREWALLDIR)
install -c -m 0644 include/firewalld/warewulf.xml $(DESTDIR)$(FIREWALLDIR)
mkdir -p $(DESTDIR)/usr/lib/systemd/system
install -c -m 0644 include/systemd/warewulfd.service $(DESTDIR)/usr/lib/systemd/system
cp bash_completion.d/warewulf $(DESTDIR)/etc/bash_completion.d/
@@ -110,15 +132,15 @@ files: all
init:
systemctl daemon-reload
cp -r tftpboot/* /var/lib/tftpboot/warewulf/ipxe/
restorecon -r /var/lib/tftpboot/warewulf
cp -r tftpboot/* $(TFTPROOT)/warewulf/ipxe/
restorecon -r $(TFTPROOT)/warewulf
debfiles: debian
chmod +x $(DESTDIR)/var/warewulf/overlays/system/debian/init
chmod 600 $(DESTDIR)/var/warewulf/overlays/system/debian/etc/ssh/ssh*
chmod 644 $(DESTDIR)/var/warewulf/overlays/system/debian/etc/ssh/ssh*.pub.ww
mkdir -p $(DESTDIR)/var/warewulf/overlays/system/debian/warewulf/bin/
cp wwclient $(DESTDIR)/var/warewulf/overlays/system/debian/warewulf/bin/
chmod +x $(DESTDIR)$(WWROOT)/warewulf/overlays/system/debian/init
chmod 600 $(DESTDIR)$(WWROOT)/warewulf/overlays/system/debian/etc/ssh/ssh*
chmod 644 $(DESTDIR)$(WWROOT)/warewulf/overlays/system/debian/etc/ssh/ssh*.pub.ww
mkdir -p $(DESTDIR)$(WWROOT)/warewulf/overlays/system/debian/warewulf/bin/
cp wwclient $(DESTDIR)$(WWROOT)/warewulf/overlays/system/debian/warewulf/bin/
wwctl:
cd cmd/wwctl; GOOS=linux go build -ldflags="-X 'github.com/hpcng/warewulf/internal/pkg/version.Version=$(VERSION_FULL)'" -mod vendor -tags "$(WW_BUILD_GO_BUILD_TAGS)" -o ../../wwctl
@@ -148,12 +170,17 @@ man_pages: man_page
./man_page ./man_pages
cd man_pages; for i in wwctl*1; do echo "Compressing manpage: $$i"; gzip --force $$i; done
config_defaults:
cd cmd/config_defaults && go build -ldflags="-X 'github.com/hpcng/warewulf/internal/pkg/warewulfconf.ConfigFile=$(CONFIG)/etc/warewulf.conf'\
-X 'github.com/hpcng/warewulf/internal/pkg/node.ConfigFile=$(CONFIG)/etc/nodes.conf'"\
-mod vendor -tags "$(WW_BUILD_GO_BUILD_TAGS)" -o ../../config_defaults
dist: vendor
rm -rf _dist/warewulf-$(VERSION)
mkdir -p _dist/warewulf-$(VERSION)
git archive --format=tar $(SRC) | tar -xf - -C _dist/warewulf-$(VERSION)
cp -r vendor _dist/warewulf-$(VERSION)/
sed -e 's/@VERSION@/$(VERSION)/g; s/@RELEASE@/$(RELEASE)/g' warewulf.spec.in > _dist/warewulf-$(VERSION)/warewulf.spec
cp warewulf.spec _dist/warewulf-$(VERSION)/
cd _dist; tar -czf ../warewulf-$(VERSION).tar.gz warewulf-$(VERSION)
clean:
@@ -166,6 +193,7 @@ clean:
rm -f man_page
rm -rf man_pages
rm -rf vendor
rm -f config_defaults
install: files install_wwclient

View File

@@ -0,0 +1,26 @@
package main
// Regenerates the default configuration files
// Keeps the current content and adds missing default values
// Won't create a new file, but will update a blank file
//TODO: Add nodes.conf
import (
"fmt"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
)
func main() {
tmpConf, err := warewulfconf.New()
if err != nil {
fmt.Println(err)
return
}
err = tmpConf.Persist()
if err != nil {
fmt.Println(err)
return
}
}

View File

@@ -6,6 +6,7 @@ warewulf:
autobuild overlays: true
update interval: 60
syslog: false
datastore: @WWROOT@/warewulf
dhcp:
enabled: true
range start: 192.168.200.50
@@ -14,7 +15,7 @@ dhcp:
systemd name: dhcpd
tftp:
enabled: true
tftproot: /var/lib/tftpboot
tftproot: @TFTPROOT@
systemd name: tftp
nfs:
systemd name: nfs-server
@@ -25,4 +26,4 @@ nfs:
mount: true
- path: /opt
export options: ro,sync,no_root_squash
mount: false
mount: false

View File

@@ -9,6 +9,8 @@ import (
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"github.com/hpcng/warewulf/internal/pkg/overlay"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"os"
"github.com/hpcng/warewulf/internal/pkg/config"
"github.com/hpcng/warewulf/internal/pkg/overlay"
"github.com/hpcng/warewulf/internal/pkg/container"
"github.com/hpcng/warewulf/internal/pkg/kernel"
"github.com/hpcng/warewulf/internal/pkg/node"
@@ -70,11 +70,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
if node.SystemOverlay.Get() != "" {
if util.IsFile(config.SystemOverlayImage(node.Id.Get())) {
if util.IsFile(overlay.SystemOverlayImage(node.Id.Get())) {
systemo_good = true
} else {
status = false
wwlog.Printf(wwlog.VERBOSE, "System Overlay not found: %s\n", config.SystemOverlayImage(node.Id.Get()))
wwlog.Printf(wwlog.VERBOSE, "System Overlay not found: %s\n", overlay.SystemOverlayImage(node.Id.Get()))
}
} else {
status = false
@@ -82,11 +82,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
if node.RuntimeOverlay.Get() != "" {
if util.IsFile(config.RuntimeOverlayImage(node.Id.Get())) {
if util.IsFile(overlay.RuntimeOverlayImage(node.Id.Get())) {
runtimeo_good = true
} else {
status = false
wwlog.Printf(wwlog.VERBOSE, "Runtime Overlay not found: %s\n", config.RuntimeOverlaySource(node.Id.Get()))
wwlog.Printf(wwlog.VERBOSE, "Runtime Overlay not found: %s\n", overlay.RuntimeOverlaySource(node.Id.Get()))
}
} else {
status = false

View File

@@ -31,9 +31,25 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
fmt.Printf("%-30s %-12s\n", "OVERLAY NAME", "FILES/DIRS")
}
<<<<<<< HEAD
for o := range overlays {
name := overlays[o]
path := overlay.OverlaySourceDir(name)
=======
for o := range overlayList {
var path string
name := overlayList[o]
if overlayName != "" && overlayName != name {
continue
}
if overlayKind == "system" {
path = overlay.SystemOverlaySource(overlayList[o])
} else if overlayKind == "runtime" {
path = overlay.RuntimeOverlaySource(overlayList[o])
}
>>>>>>> eb32d41... Add config option for shared state dir
if util.IsDir(path) {
files := util.FindFiles(path)
@@ -60,7 +76,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
sys := s.Sys()
<<<<<<< HEAD
fmt.Printf("%v %5d %-5d %-18s /%s\n", perms, sys.(*syscall.Stat_t).Uid, sys.(*syscall.Stat_t).Gid, overlays[o], files[file])
=======
fmt.Printf("%v %5d %-5d %-18s /%s\n", perms, sys.(*syscall.Stat_t).Uid, sys.(*syscall.Stat_t).Gid, overlayList[o], files[file])
>>>>>>> eb32d41... Add config option for shared state dir
}
} else {
@@ -68,7 +88,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
} else {
<<<<<<< HEAD
wwlog.Printf(wwlog.ERROR, "system/%s (path not found:%s)\n", overlays[o], path)
=======
wwlog.Printf(wwlog.ERROR, "system/%s (path not found:%s)\n", overlayList[o], path)
>>>>>>> eb32d41... Add config option for shared state dir
}
}

View File

@@ -9,13 +9,13 @@ import (
"github.com/containers/storage/drivers/copy"
"github.com/pkg/errors"
"github.com/hpcng/warewulf/internal/pkg/config"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
"github.com/hpcng/warewulf/internal/pkg/oci"
"github.com/hpcng/warewulf/internal/pkg/util"
)
func ImportDocker(uri string, name string, sCtx *types.SystemContext) error {
OciBlobCacheDir := config.LocalStateDir + "/oci/blobs"
OciBlobCacheDir := warewulfconf.DataStore() + "/oci/blobs"
err := os.MkdirAll(OciBlobCacheDir, 0755)
if err != nil {

View File

@@ -7,7 +7,7 @@ import (
"github.com/pkg/errors"
"github.com/hpcng/warewulf/internal/pkg/config"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
)
@@ -21,7 +21,7 @@ func ValidName(name string) bool {
}
func SourceParentDir() string {
return path.Join(config.LocalStateDir, "chroots")
return path.Join(warewulfconf.DataStore(), "chroots")
}
func SourceDir(name string) string {
@@ -33,7 +33,7 @@ func RootFsDir(name string) string {
}
func ImageParentDir() string {
return path.Join(config.LocalStateDir, "provision/container/")
return path.Join(warewulfconf.DataStore(), "provision/container/")
}
func ImageFile(name string) string {

View File

@@ -11,7 +11,7 @@ import (
"github.com/pkg/errors"
"github.com/hpcng/warewulf/internal/pkg/config"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
)
@@ -27,7 +27,7 @@ var (
)
func ParentDir() string {
return path.Join(config.LocalStateDir, "provision/kernel")
return path.Join(warewulfconf.DataStore(), "provision/kernel")
}
func KernelImage(kernelName string) string {
@@ -111,7 +111,7 @@ func ListKernels() ([]string, error) {
func Build(kernelVersion string, kernelName string, root string) (string, error) {
kernelDrivers := path.Join(root, "/lib/modules/"+kernelVersion)
kernelDriversRelative := path.Join("/lib/modules/"+kernelVersion)
kernelDriversRelative := path.Join("/lib/modules/"+kernelVersion)
kernelDestination := KernelImage(kernelName)
driversDestination := KmodsImage(kernelName)
versionDestination := KernelVersion(kernelName)

View File

@@ -9,12 +9,6 @@ import (
"github.com/containers/image/v5/types"
)
const (
defaultCachePath = "/var/warewulf/container-cache/oci/"
blobPrefix = "blobs"
rootfsPrefix = "rootfs"
)
type CacheOpt func(*Cache) error
func OptSetCachePath(path string) CacheOpt {

View File

@@ -0,0 +1,11 @@
package oci
import "github.com/hpcng/warewulf/internal/pkg/warewulfconf"
import "path/filepath"
var defaultCachePath = filepath.Join(warewulfconf.DataStore(), "/container-cache/oci/")
const (
blobPrefix = "blobs"
rootfsPrefix = "rootfs"
)

View File

@@ -1,19 +1,15 @@
package config
package overlay
import (
"fmt"
"path"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
)
const (
LocalStateDir = "/var/warewulf"
"github.com/hpcng/warewulf/internal/pkg/warewulfconf"
)
func OverlayDir() string {
return fmt.Sprintf("%s/overlays/", LocalStateDir)
return path.Join(warewulfconf.DataStore(), "provision/overlays")
}
func SystemOverlayDir() string {
@@ -63,7 +59,7 @@ func SystemOverlayImage(nodeName string) string {
return ""
}
return fmt.Sprintf("%s/provision/overlays/system/%s.img", LocalStateDir, nodeName)
return path.Join(SystemOverlayDir(), nodeName+".img")
}
func RuntimeOverlayImage(nodeName string) string {
@@ -77,5 +73,5 @@ func RuntimeOverlayImage(nodeName string) string {
return ""
}
return fmt.Sprintf("%s/provision/overlays/runtime/%s.img", LocalStateDir, nodeName)
return path.Join(RuntimeOverlayDir(), nodeName+".img")
}

View File

@@ -12,7 +12,6 @@ import (
"strings"
"text/template"
"github.com/hpcng/warewulf/internal/pkg/config"
"github.com/hpcng/warewulf/internal/pkg/node"
"github.com/hpcng/warewulf/internal/pkg/util"
"github.com/hpcng/warewulf/internal/pkg/wwlog"

View File

@@ -4,22 +4,25 @@ import (
"fmt"
"io/ioutil"
"net"
"errors"
"github.com/brotherpowers/ipsubnet"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
"gopkg.in/yaml.v2"
)
var singleton ControllerConf
var cachedConf ControllerConf
func New() (ControllerConf, error) {
var ret ControllerConf
var ret ControllerConf = *defaultConfig()
if (ControllerConf{}) == singleton {
// Check if cached config is old before re-reading config file
if !cachedConf.current {
wwlog.Printf(wwlog.DEBUG, "Opening Warewulf configuration file: %s\n", ConfigFile)
data, err := ioutil.ReadFile(ConfigFile)
if err != nil {
fmt.Printf("error reading Warewulf configuration file\n")
fmt.Printf("Error reading Warewulf configuration file\n")
return ret, err
}
@@ -29,11 +32,16 @@ func New() (ControllerConf, error) {
return ret, err
}
// TODO: Need to add comprehensive config file validator
// TODO: Change function to guess default IP address and/or mask from local system
if ret.Ipaddr == "" {
wwlog.Printf(wwlog.WARN, "IP address is not configured in warewulfd.conf\n")
wwlog.Printf(wwlog.ERROR, "IP address is not configured in warewulfd.conf\n")
return ret, errors.New("no IP Address")
}
if ret.Netmask == "" {
wwlog.Printf(wwlog.WARN, "Netmask is not configured in warewulfd.conf\n")
wwlog.Printf(wwlog.ERROR, "Netmask is not configured in warewulfd.conf\n")
return ret, errors.New("no netmask")
}
if ret.Network == "" {
@@ -46,16 +54,17 @@ func New() (ControllerConf, error) {
}
if ret.Warewulf.Port == 0 {
ret.Warewulf.Port = 9873
ret.Warewulf.Port = defaultPort
}
wwlog.Printf(wwlog.DEBUG, "Returning warewulf config object\n")
singleton = ret
cachedConf = ret
cachedConf.current = true
} else {
wwlog.Printf(wwlog.DEBUG, "Returning cached warewulf config object\n")
ret = singleton
// If cached struct isn't empty, use it as the return value
ret = cachedConf
}
return ret, nil

View File

@@ -6,10 +6,8 @@ import (
"github.com/hpcng/warewulf/internal/pkg/wwlog"
)
var ConfigFile = "/etc/warewulf/warewulf.conf"
type ControllerConf struct {
Comment string `yaml:"comment"`
Comment string `yaml:"comment,omitempty"`
Ipaddr string `yaml:"ipaddr"`
Netmask string `yaml:"netmask"`
Network string `yaml:"network,omitempty"`
@@ -18,14 +16,16 @@ type ControllerConf struct {
Dhcp *DhcpConf `yaml:"dhcp"`
Tftp *TftpConf `yaml:"tftp"`
Nfs *NfsConf `yaml:"nfs"`
current bool
}
type WarewulfConf struct {
Port int `yaml:"port"`
Secure bool `yaml:"secure"`
UpdateInterval int `yaml:"update interval"`
AutobuildOverlays bool `yaml:"autobuild overlays"`
Syslog bool `yaml:"syslog"`
Port int `yaml:"port"`
Secure bool `yaml:"secure"`
UpdateInterval int `yaml:"update interval"`
AutobuildOverlays bool `yaml:"autobuild overlays"`
Syslog bool `yaml:"syslog"`
DataStore string `yaml:"datastore"`
}
type DhcpConf struct {
@@ -34,7 +34,7 @@ type DhcpConf struct {
RangeStart string `yaml:"range start"`
RangeEnd string `yaml:"range end"`
SystemdName string `yaml:"systemd name"`
ConfigFile string `yaml:"config file"`
ConfigFile string `yaml:"config file,omitempty"`
}
type TftpConf struct {
@@ -70,11 +70,20 @@ func (s *NfsConf) UnmarshalYAML(unmarshal func(interface{}) error) error {
return nil
}
func init() {
//TODO: Check to make sure nodes.conf is found
if !util.IsFile(ConfigFile) {
wwlog.Printf(wwlog.ERROR, "Configuration file not found: %s\n", ConfigFile)
// fail silently as this also called by bash_completion
return
}
_, err := New()
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not read Warewulf configuration file: %s\n", err)
}
}
// Waste processor cycles to make code more readable
func DataStore() string {
return cachedConf.Warewulf.DataStore
}

View File

@@ -0,0 +1,47 @@
package warewulfconf
const (
defaultDataStore string = "/srv/warewulf"
defaultPort int = 9983
)
var ConfigFile string = "/etc/warewulf/warewulf.conf"
func defaultConfig() *ControllerConf {
Warewulf := &WarewulfConf{
Port: defaultPort,
Secure: true,
UpdateInterval: 60,
AutobuildOverlays: true,
Syslog: false,
DataStore: defaultDataStore,
}
Dhcp := &DhcpConf{
Enabled: true,
Template: "default",
RangeStart: "192.168.200.50",
RangeEnd: "192.168.200.99",
SystemdName: "dhcpd",
ConfigFile: "/etc/dhcp/dhcpd.conf",
}
Tftp := &TftpConf{
Enabled: true,
TftpRoot: "/var/lib/tftpboot",
SystemdName: "tftp",
}
Nfs := &NfsConf{
Enabled: true,
Exports: []string{"/home",
defaultDataStore,
},
SystemdName: "nfs-server",
}
return &ControllerConf{
Warewulf: Warewulf,
Dhcp: Dhcp,
Tftp: Tftp,
Nfs: Nfs,
current: false,
}
}

View File

@@ -22,8 +22,9 @@ func (controller *ControllerConf) Persist() error {
defer file.Close()
_, err = file.WriteString(string(out))
_, err = file.WriteString(string(out)+"\n")
if err != nil {
wwlog.Printf(wwlog.ERROR, "Unable to write to warewulf.conf\n")
return err
}

View File

@@ -1,5 +1,5 @@
%global wwgroup warewulf
%{!?wwshared: %global wwshared %{_localstatedir}}
%global wwshared @WWROOT@/warewulf
%define debug_package %{nil}
Name: warewulf
@@ -51,6 +51,9 @@ system for large clusters of bare metal and/or virtual systems.
%build
%if 0%{?sle_version}
make all TFTPROOT="/srv/tftpboot"
%else
make all
@@ -86,16 +89,15 @@ getent group %{wwgroup} >/dev/null || groupadd -r %{wwgroup}
%{wwshared}/%{name}/overlays/system/*
%attr(-, root, root) %{_bindir}/wwctl
%if 0%{?rhel}
%attr(-, root, root) %{_prefix}/lib/firewalld/services/warewulf.xml
%else
# sle_version
%attr(-, root, root) %{_libexecdir}/firewalld/services/warewulf.xml
%endif
%attr(-, root, root) %{_unitdir}/warewulfd.service
%attr(-, root, root) %{_mandir}/man1/wwctl*
%changelog
* Wed Dec 15 2021 Jeremy Siadal <jeremy.c.siadal@intel.com> - 4.2.0-1
- Relocate tftpboot for OpenSUSE
- Remove libexecdir macro; changing in OpenSUSE 15.4
* Mon Nov 1 2021 Jeremy Siadal <jeremy.c.siadal@intel.com> - 4.2.0-1
- Add support for OpenSUSE
- Update file attribs