2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-04 20:17:55 +00:00

fix(xcat-core): do not add a second syncfiles when the node already defers it

A node may list syncfiles in both postscripts and postbootscripts -- once for the install and
once for the booted node. The deferral prepended its own copy regardless, so the booted node ran
syncfiles twice in a row inside a marker block that made it look like xCAT had generated the
duplicate.

Keep the entry the node already has and still remove the install-time one, which is the copy
that cannot work in the in-target chroot.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-08-28 09:45:56 -03:00
parent e62a66c70d
commit 0f12faa0fc
2 changed files with 15 additions and 0 deletions
+5
View File
@@ -214,6 +214,11 @@ sub defer_syncfiles_to_postboot {
unless defined($postscripts) && $postscripts =~ s/^[ \t]*syncfiles[ \t]*\n//m;
$postbootscripts = "" unless defined $postbootscripts;
# A node may already list syncfiles as a postbootscript of its own; do not add a second copy.
return ($postscripts, $postbootscripts)
if $postbootscripts =~ /^[ \t]*syncfiles[ \t]*$/m;
$postbootscripts =
"# ubuntu-deferred-postbootscripts-start-here\nsyncfiles\n# ubuntu-deferred-postbootscripts-end-here\n"
. $postbootscripts;
@@ -83,6 +83,16 @@ foreach my $case (@untouched) {
is($postboot, $DEFERRED, 'an undefined postbootscripts list becomes the deferral block');
}
# A node that already lists syncfiles as its own postbootscript keeps that entry, and does not
# gain a second one -- the install-time copy is still removed, since that is the one that cannot work.
{
my ($post, $postboot) =
defer('ubuntu24.04', 'install', 'install', "syncfiles\nfoo\n", "syncfiles\nsetupntp\n");
is($post, "foo\n", 'the postscripts entry is still removed');
is($postboot, "syncfiles\nsetupntp\n",
"an admin's own syncfiles postbootscript is left as it was, not duplicated");
}
# Rendering the same node twice must not stack a second copy.
{
my ($post, $postboot) =