Merge branch 'main' into dracut-asset-tag-urlencode

This commit is contained in:
Xu YANG
2025-02-07 11:55:03 +09:00
committed by GitHub
15 changed files with 86 additions and 76 deletions

1
.gitattributes vendored
View File

@@ -1 +1,2 @@
CHANGELOG.md merge=union
.github/ export-ignore

View File

@@ -1,6 +1,6 @@
name: "\U0001F41E Bug report"
type: Bug
description: Report a bug in Warewulf (command not working as expected, etc.)
labels: [bug]
body:
- type: textarea
id: reproduce

View File

@@ -1,6 +1,6 @@
name: "\U0001F38A Feature request"
type: Feature
description: Suggest adding a feature
labels: [enhancement]
body:
- type: textarea
id: summary

View File

@@ -10,11 +10,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Document defining kernel args that include commas. #1679
- Recommend installing ipmitool with Warewulf package. #970
- Add completion for profile list. #1695
### Changed
- `wwctl node list <--yaml|--json>` outputs a map keyed by node name. #1667
- Don't mount /run during wwinit. #1566
- Simpler permissions in official RPM packages. #1696
- Create temporary files in overlay directory during `wwctl overlay edit`. #1473
### Fixed
@@ -32,6 +35,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix a warewulfd panic when no kernel fields are specified. #1689
- Create site overlay directory. #1690
- Urlencode asset keys during dracut boot. #1610
- Set execute permissions for intermediate directories during `wwctl overlay import --parents`. #1655
- Fix log output formatting during overlay build.
- Prevent merging of zero-value net.IP fields. #1710
## v4.6.0rc1, 2025-01-29

View File

@@ -95,6 +95,7 @@ test-cover: $(config)
install: build docs
install -d -m 0755 $(DESTDIR)$(BINDIR)
install -d -m 0755 $(DESTDIR)$(WWCHROOTDIR)
install -d -m 0755 $(DESTDIR)$(WWOVERLAYDIR)
install -d -m 0755 $(DESTDIR)$(WWPROVISIONDIR)
install -d -m 0755 $(DESTDIR)$(DATADIR)/warewulf/overlays/wwinit/rootfs/$(WWCLIENTDIR)
install -d -m 0755 $(DESTDIR)$(DATADIR)/warewulf/overlays/wwclient/rootfs/$(WWCLIENTDIR)
@@ -158,13 +159,14 @@ init:
restorecon -r $(WWTFTPDIR)
.PHONY: dist
dist:
rm -rf .dist/ $(WAREWULF)-$(VERSION).tar.gz
dist: $(config)
rm -rf .dist/
mkdir -p .dist/$(WAREWULF)-$(VERSION)
rsync -a --exclude=".github" --exclude=".vscode" --exclude "*~" --exclude $(WAREWULF)-*.tar.gz * .dist/$(WAREWULF)-$(VERSION)/
tar -c --files-from <(git ls-files) | tar -C .dist/$(WAREWULF)-$(VERSION) -x
cp -a vendor/ $(config) .dist/$(WAREWULF)-$(VERSION)
scripts/get-version.sh >.dist/$(WAREWULF)-$(VERSION)/VERSION
cd .dist; tar -czf ../$(WAREWULF)-$(VERSION).tar.gz $(WAREWULF)-$(VERSION)
rm -rf .dist
tar -C .dist -czf $(WAREWULF)-$(VERSION).tar.gz $(WAREWULF)-$(VERSION)
rm -rf .dist/
.PHONY: reference
reference: wwctl

View File

@@ -52,3 +52,11 @@ func Images(cmd *cobra.Command, args []string, toComplete string) ([]string, cob
sources, _ := image.ListSources()
return sources, cobra.ShellCompDirectiveNoFileComp
}
func Profiles(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) != 0 {
return nil, cobra.ShellCompDirectiveNoFileComp
}
registry, _ := node.New()
return registry.ListAllProfiles(), cobra.ShellCompDirectiveNoFileComp
}

View File

@@ -48,7 +48,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
return fmt.Errorf("%s does not exist. Use '--parents' option to create automatically", overlayFileDir)
}
tempFile, tempFileErr := os.CreateTemp("", "ww-overlay-edit-")
tempFile, tempFileErr := os.CreateTemp(overlay_.Path(), "ww-overlay-edit-")
if tempFileErr != nil {
return fmt.Errorf("unable to create temporary file for editing: %s", tempFileErr)
}

View File

@@ -51,11 +51,13 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
wwlog.Debug("Create dir: %s", parent)
srcInfo, err := os.Stat(source)
if err != nil {
return fmt.Errorf("could not retrieve the stat for file: %s", err)
return fmt.Errorf("could not retrieve the stat for file: %w", err)
}
err = os.MkdirAll(parent, srcInfo.Mode())
mode := srcInfo.Mode()
mode |= ((mode & 0444) >> 2) // add execute permission wherever srcInfo has read
err = os.MkdirAll(parent, mode)
if err != nil {
return fmt.Errorf("could not create parent dif: %s: %v", parent, err)
return fmt.Errorf("could not create parent dir: %s: %w", parent, err)
}
}
}

View File

@@ -2,7 +2,7 @@ package delete
import (
"github.com/spf13/cobra"
"github.com/warewulf/warewulf/internal/pkg/node"
"github.com/warewulf/warewulf/internal/app/wwctl/completions"
)
var (
@@ -14,13 +14,7 @@ var (
Aliases: []string{"remove", "rm", "del"},
RunE: CobraRunE,
Args: cobra.MinimumNArgs(1),
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) != 0 {
return nil, cobra.ShellCompDirectiveNoFileComp
}
nodeDB, _ := node.New()
return nodeDB.ListAllProfiles(), cobra.ShellCompDirectiveNoFileComp
},
ValidArgsFunction: completions.Profiles,
}
SetYes bool
)

View File

@@ -1,6 +1,9 @@
package list
import "github.com/spf13/cobra"
import (
"github.com/spf13/cobra"
"github.com/warewulf/warewulf/internal/app/wwctl/completions"
)
type variables struct {
showAll bool
@@ -18,6 +21,7 @@ func GetCommand() *cobra.Command {
Long: "This command will display configurations for PROFILE.",
RunE: CobraRunE(&vars),
Aliases: []string{"ls"},
ValidArgsFunction: completions.Profiles,
}
baseCmd.PersistentFlags().BoolVarP(&vars.showAll, "all", "a", false, "Show all profile configurations")
baseCmd.PersistentFlags().BoolVarP(&vars.showYaml, "yaml", "y", false, "Show profile configurations via yaml format")

View File

@@ -36,18 +36,10 @@ func GetCommand() *cobra.Command {
Short: "Configure node profile properties",
Long: "This command sets configuration properties for the node PROFILE(s).\n\n" +
"Note: use the string 'UNSET' to remove a configuration",
Aliases: []string{"modify"},
Args: cobra.MinimumNArgs(0),
RunE: CobraRunE(&vars),
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) != 0 {
return nil, cobra.ShellCompDirectiveNoFileComp
}
nodeDB, _ := node.New()
profiles := nodeDB.ListAllProfiles()
return profiles, cobra.ShellCompDirectiveNoFileComp
},
Aliases: []string{"modify"},
Args: cobra.MinimumNArgs(0),
RunE: CobraRunE(&vars),
ValidArgsFunction: completions.Profiles,
}
vars.profileConf.CreateFlags(baseCmd)
vars.profileDel.CreateDelFlags(baseCmd)

View File

@@ -71,7 +71,7 @@ type Transformer struct{}
func (t Transformer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {
if typ == reflect.TypeOf(net.IP{}) {
return func(dst, src reflect.Value) error {
if !src.IsValid() || !src.CanSet() {
if !src.IsValid() || src.IsZero() {
return nil
}
dst.Set(src)

View File

@@ -935,11 +935,14 @@ nodeprofiles:
nodes:
n1:
profiles:
- p1`,
node: "n1",
field: "NetDevs[default].Netmask",
source: "p1",
value: "255.255.255.0",
- p1
network devices:
default:
ipaddr: 192.168.1.1`,
nodes: []string{"n1", "n1"},
fields: []string{"NetDevs[default].Netmask", "NetDevs[default].Ipaddr"},
sources: []string{"p1", ""},
values: []string{"255.255.255.0", "192.168.1.1"},
},
}

View File

@@ -146,7 +146,7 @@ func BuildSpecificOverlays(nodes []node.Node, allNodes []node.Node, overlayNames
var wg sync.WaitGroup
worker := func() {
for n := range nodeChan {
wwlog.Info("Building overlay for %s: %v", n, overlayNames)
wwlog.Info("Building overlay for %s: %v", n.Id(), overlayNames)
for _, overlayName := range overlayNames {
err := BuildOverlay(n, allNodes, "", []string{overlayName})
if err != nil {

View File

@@ -174,68 +174,66 @@ getent group %{wwgroup} >/dev/null || groupadd -r %{wwgroup}
%files
%dir %{_sysconfdir}/bash_completion.d
%dir %{_sysconfdir}/logrotate.d
%defattr(-, root, root)
%defattr(-, root, %{wwgroup})
%dir %{_sysconfdir}/warewulf
%config(noreplace) %{_sysconfdir}/warewulf/warewulf.conf
%config(noreplace) %attr(0640,-,%{wwgroup}) %{_sysconfdir}/warewulf/nodes.conf
%config(noreplace) %{_sysconfdir}/warewulf/examples
%config(noreplace) %{_sysconfdir}/warewulf/ipxe
%config(noreplace) %{_sysconfdir}/warewulf/grub
%config(noreplace) %{_sysconfdir}/logrotate.d/warewulfd.conf
%config(noreplace) %attr(0640,-,-) %{_sysconfdir}/warewulf/nodes.conf
%{_sysconfdir}/bash_completion.d/wwctl
%{_sysconfdir}/bash_completion.d
%config(noreplace) %{_sysconfdir}/logrotate.d
%dir %{_sharedstatedir}/warewulf
%dir %{_sharedstatedir}/warewulf/chroots
%dir %{_sharedstatedir}/warewulf/overlays
%dir %{_datadir}/warewulf
%{_datadir}/warewulf/bmc
%dir %{_datadir}/warewulf/overlays
%dir %{_datadir}/warewulf/overlays/*
%dir %{_datadir}/warewulf/overlays/*/rootfs
%attr(-, root, root) %{_datadir}/warewulf/overlays/NetworkManager/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/debian.interfaces/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/debug/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/fstab/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/host/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/hostname/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/hosts/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/ifcfg/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/ignition/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/issue/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/netplan/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/resolv/rootfs/*
%attr(700, root, root) %{_datadir}/warewulf/overlays/ssh.authorized_keys/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/ssh.host_keys/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/syncuser/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/systemd.netname/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/udev.netname/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/wicked/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/wwclient/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/wwinit/rootfs/*
%attr(-, root, root) %{_datadir}/warewulf/overlays/localtime/rootfs/*
%{_datadir}/warewulf/overlays/NetworkManager/rootfs/*
%{_datadir}/warewulf/overlays/debian.interfaces/rootfs/*
%{_datadir}/warewulf/overlays/debug/rootfs/*
%{_datadir}/warewulf/overlays/fstab/rootfs/*
%{_datadir}/warewulf/overlays/host/rootfs/*
%{_datadir}/warewulf/overlays/hostname/rootfs/*
%{_datadir}/warewulf/overlays/hosts/rootfs/*
%{_datadir}/warewulf/overlays/ifcfg/rootfs/*
%{_datadir}/warewulf/overlays/ignition/rootfs/*
%{_datadir}/warewulf/overlays/issue/rootfs/*
%{_datadir}/warewulf/overlays/netplan/rootfs/*
%{_datadir}/warewulf/overlays/resolv/rootfs/*
%attr(700, -, -) %{_datadir}/warewulf/overlays/ssh.authorized_keys/rootfs/*
%{_datadir}/warewulf/overlays/ssh.host_keys/rootfs/*
%{_datadir}/warewulf/overlays/syncuser/rootfs/*
%{_datadir}/warewulf/overlays/systemd.netname/rootfs/*
%{_datadir}/warewulf/overlays/udev.netname/rootfs/*
%{_datadir}/warewulf/overlays/wicked/rootfs/*
%{_datadir}/warewulf/overlays/wwclient/rootfs/*
%{_datadir}/warewulf/overlays/wwinit/rootfs/*
%{_datadir}/warewulf/overlays/localtime/rootfs/*
%attr(-, root, root) %{_bindir}/wwctl
%attr(-, root, root) %{_prefix}/lib/firewalld/services/warewulf.xml
%attr(-, root, root) %{_unitdir}/warewulfd.service
%attr(-, root, root) %{_mandir}/man1/wwctl*
%attr(-, root, root) %{_mandir}/man5/*.5*
%attr(-, root, root) %{_datadir}/warewulf
%{_bindir}/wwctl
%{_prefix}/lib/firewalld/services/warewulf.xml
%{_unitdir}/warewulfd.service
%{_mandir}/man1/wwctl*
%{_mandir}/man5/*.5*
%dir %{_docdir}/warewulf
%license %{_docdir}/warewulf/LICENSE.md
%if %{api}
%attr(-, root, root) %{_bindir}/wwapi*
%{_bindir}/wwapi*
%config(noreplace) %{_sysconfdir}/warewulf/wwapi*.conf
%endif
%files dracut
%defattr(-, root, root)
%dir %{_prefix}/lib/dracut/modules.d/90wwinit
%{_prefix}/lib/dracut/modules.d/90wwinit/*.sh
%{_prefix}/lib/dracut/modules.d/90wwinit
%changelog