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

fix(postage): the provmethod override in makescript can never fire

The syncfiles deferral resolved the node's provmethod through
$image_hash{$osimgname}{provmethod} when the node names an osimage. makescript
fills %image_hash from getImage(), which stores pkglist, pkgdir, otherpkglist,
otherpkgdir and environvar -- and no provmethod. getScripts() has a separate
hash that does store one, which is where the pattern was copied from. So the
lookup was always undef, the override never fired, and the code claimed a
behaviour it did not have.

Pass $provmethod directly and say in the comment why there is nothing to
resolve it with. No behaviour changes -- the branch was inert -- so there is no
red to show first; what the deletion needs is coverage that the path it was
supposed to serve still works.

That is what the two new assertions do: an osimage-named provmethod with
nodesetstate 'install' still defers, and the same name with no nodesetstate is
not mistaken for a diskful install. nodesetstate is what carries the install
signal here, which is why the override was never load-bearing. Making the
deferral ignore nodesetstate and require provmethod eq 'install' reddens both.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-09-01 21:48:54 -03:00
parent b784aa782c
commit 73ebe96f72
2 changed files with 30 additions and 5 deletions
+8 -5
View File
@@ -601,12 +601,15 @@ sub makescript {
# See defer_syncfiles_to_postboot(): on the Ubuntu/Debian diskful install path syncfiles
# has to run on the booted node, not in the installer's in-target chroot.
my $effective_provmethod = $provmethod;
if ($osimgname && defined($image_hash{$osimgname}{'provmethod'})) {
$effective_provmethod = $image_hash{$osimgname}{'provmethod'};
}
#
# $provmethod is passed as-is. An earlier version tried to resolve it through
# $image_hash{$osimgname}{provmethod} when the node names an osimage, but makescript
# fills %image_hash from getImage(), which stores pkglist/pkgdir/otherpkg*/environvar and
# no provmethod -- getScripts() has a separate hash that does. So that lookup was always
# undef and the override never fired. $nodesetstate is what carries the install signal on
# this path anyway: nodeset sets it, and defer_syncfiles_to_postboot checks it first.
($postscripts, $postbootscripts) = defer_syncfiles_to_postboot(
$os, $effective_provmethod, $nodesetstate, $postscripts, $postbootscripts);
$os, $provmethod, $nodesetstate, $postscripts, $postbootscripts);
# if using zones then must go to the zone.sshbetweennodes
# else go to site.sshbetweennodes
@@ -102,4 +102,26 @@ foreach my $case (@untouched) {
is($postboot2, $postboot, 'a second pass does not duplicate syncfiles');
}
# The node's provmethod is frequently an osimage NAME rather than the literal 'install' -- that
# is what makescript passes, and resolving it to a real provmethod is not possible there
# (getImage does not store one). nodesetstate is what carries the install signal on that path,
# so the deferral must key off it and not require provmethod to say 'install'.
{
my ($post, $postboot) = defer(
'ubuntu24.04', 'ubuntu24.04-x86_64-install-compute', 'install',
"otherpkgs\nsyncfiles\nremoteshell\n", "" );
unlike( $post, qr/^syncfiles$/m,
'an osimage-named provmethod still defers when nodesetstate says install' );
like( $postboot, qr/^syncfiles$/m,
'and syncfiles lands in the postboot scripts' );
}
{
my ($post, $postboot) = defer(
'ubuntu24.04', 'ubuntu24.04-x86_64-install-compute', undef,
"otherpkgs\nsyncfiles\nremoteshell\n", "" );
like( $post, qr/^syncfiles$/m,
'with no nodesetstate an osimage name is not mistaken for a diskful install' );
}
done_testing();