summaryrefslogtreecommitdiffstats
path: root/config-db/slxconfig-demuxer
diff options
context:
space:
mode:
authorOliver Tappe2008-02-01 20:35:23 +0100
committerOliver Tappe2008-02-01 20:35:23 +0100
commit92abb7e97ca141972124782d1b9b25a2c242c347 (patch)
treee45fc39e1e64258b542315a5301e05bf1f0b66d5 /config-db/slxconfig-demuxer
parent* slurpFile now supports returning the file as an array of lines (diff)
downloadcore-92abb7e97ca141972124782d1b9b25a2c242c347.tar.gz
core-92abb7e97ca141972124782d1b9b25a2c242c347.tar.xz
core-92abb7e97ca141972124782d1b9b25a2c242c347.zip
* 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
Diffstat (limited to 'config-db/slxconfig-demuxer')
-rwxr-xr-xconfig-db/slxconfig-demuxer42
1 files changed, 30 insertions, 12 deletions
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 '<<<default>>>';
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) {