diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index 6da8b3277..c575304cd 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -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 diff --git a/xCAT-test/unit/postage_ubuntu_syncfiles_postboot.t b/xCAT-test/unit/postage_ubuntu_syncfiles_postboot.t index 9962ea20c..7603c97aa 100644 --- a/xCAT-test/unit/postage_ubuntu_syncfiles_postboot.t +++ b/xCAT-test/unit/postage_ubuntu_syncfiles_postboot.t @@ -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();