From 92abb7e97ca141972124782d1b9b25a2c242c347 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Fri, 1 Feb 2008 19:35:23 +0000 Subject: * finished initial re-implementation of mkdxsinitrd in perl - there's still stuff missing and it has not been tested, either git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1508 95ad53e4-c205-0410-b2fa-d234c58c8868 --- config-db/slxconfig-demuxer | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'config-db') diff --git a/config-db/slxconfig-demuxer b/config-db/slxconfig-demuxer index c715caac..430e1772 100755 --- a/config-db/slxconfig-demuxer +++ b/config-db/slxconfig-demuxer @@ -70,6 +70,8 @@ my ( # dryRun won't touch any file $systemConfCount, # number of system configurations written + $systemErrCount, + # number of systems that had errors $clientSystemConfCount, # number of (system-specific) client configurations written %vendorOSInitramfsMap, @@ -134,7 +136,10 @@ chomp(my $slxVersion = qx{slxversion}); my $lockFile = "$openslxConfig{'private-path'}/config-demuxer.lock"; lockScript($lockFile); -END { unlockScript($lockFile) if defined $lockFile; } +END +{ + unlockScript($lockFile) if defined $lockFile; +} my $tempPath = "$openslxConfig{'temp-path'}/slxconfig-demuxer"; if (!$dryRun) { @@ -156,9 +161,12 @@ if (!$dryRun) { writeConfigurations(); -my $wr = ($dryRun ? "would have written" : "wrote"); -print - "$wr $systemConfCount system- and $clientSystemConfCount client-specific configurations to $tftpbootPath/client-config\n"; +my $wr = $dryRun ? 'would have written' : 'wrote'; +my $errCount = $systemErrCount ? $systemErrCount : 'no'; +print "\n", unshiftHereDoc(<<"End-of-Here"); + $wr $systemConfCount system- and $clientSystemConfCount client-specific configurations to $tftpbootPath/client-config + $errCount system(s) had errors +End-of-Here $openslxDB->disconnect(); @@ -560,6 +568,7 @@ sub makeInitRamFS 'export-name' => $info->{export}->{name}, 'export-uri' => $info->{'export-uri'}, 'initramfs' => "$pxeVendorOSPath/$info->{'initramfs-name'}", + 'kernel-params' => $info->{kernel_params} || '', 'kernel-version' => $kernelFile =~ m[-(.+)$] ? $1 : '', 'plugins' => $info->{'active-plugins'}, 'root-path' @@ -575,7 +584,7 @@ sub makeInitRamFS } my $makeInitRamFSEngine = OpenSLX::MakeInitRamFS::Engine->new($params); - $makeInitRamFSEngine->execute() unless $dryRun; + $makeInitRamFSEngine->execute($dryRun); return; } @@ -785,23 +794,32 @@ sub writeSystemConfiguration sub writeConfigurations { - $systemConfCount = $clientSystemConfCount = 0; + $systemConfCount = $systemErrCount = $clientSystemConfCount = 0; my @systems = $openslxDB->fetchSystemByFilter(); my @infos; foreach my $system (@systems) { next if $system->{name} eq '<<>>'; vlog( - 0, _tr('exporting system %d : %s', $system->{id}, $system->{name}) + 0, _tr("\ndemuxing system %d : %s", $system->{id}, $system->{name}) ); - $systemConfCount++; - my $info = $openslxDB->aggregatedSystemFileInfoFor($system); - $info->{'external-id'} = externalIDForSystem($system); + my $success = eval { + my $info = $openslxDB->aggregatedSystemFileInfoFor($system); + $info->{'external-id'} = externalIDForSystem($system); - writeSystemConfiguration($info); + writeSystemConfiguration($info); - push @infos, $info; + push @infos, $info; + 1; + }; + if ($success) { + $systemConfCount++; + } + else { + print STDERR $@; + $systemErrCount++; + } } writePXEMenus(@infos); if (defined $dhcpType) { -- cgit v1.2.3-55-g7522