mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-21 16:39:30 +00:00
fix(mknb): a Genesis copy that fails must fail mknb
The legacy branch ran both copies and kept only the second exit status, so an unreadable Genesis root tree left mknb exiting 0 with an initramfs built from nothing -- the node then never boots and nothing names the cause. A failing kernel copy was reported as a failure of the root tree, because the message was chosen from a flag set before either copy ran. Return on the first failing copy, carrying the name of the file that could not be read. mknb_genesis_staging.t goes from 2 failures to green on this commit. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> (cherry picked from commit d46ca3e09bf52827bf0b8fa9cb94279a9da2c97b)
This commit is contained in:
@@ -354,9 +354,13 @@ sub stage_genesis_payload {
|
||||
my $run = $a{run} || sub { return system($_[0]); };
|
||||
my $rc;
|
||||
if (($a{genesis_type} // '') eq 'legacy') {
|
||||
# Two copies, each able to fail on its own. Return on the first, so neither the exit
|
||||
# status nor the name of the unreadable file is lost to the one that follows it.
|
||||
$rc = $run->("shopt -s dotglob; GLOBIGNORE=\".:..\" cp -a $a{genesis_dir}/fs/* $a{tempdir}");
|
||||
return ($rc, "$a{genesis_dir}/fs") if $rc;
|
||||
$rc = $run->("cp -a $a{genesis_dir}/kernel $a{tftpdir}/xcat/genesis.kernel.$a{arch}");
|
||||
return ($rc, "$a{genesis_dir}/fs");
|
||||
return ($rc, "$a{genesis_dir}/kernel") if $rc;
|
||||
return (0, undef);
|
||||
}
|
||||
$rc = $run->("cp -a $a{genesis_dir}/nbroot/* $a{tempdir}");
|
||||
return ($rc, "$a{genesis_dir}/nbroot");
|
||||
|
||||
Reference in New Issue
Block a user