summaryrefslogtreecommitdiffstats
path: root/config-db/slxconfig-demuxer
diff options
context:
space:
mode:
authorOliver Tappe2007-03-15 22:41:10 +0100
committerOliver Tappe2007-03-15 22:41:10 +0100
commit03db5fcadee81bd5ce66665f18b611e106783c27 (patch)
tree1071ff956228157c52fbd5b5087ca8928b37d0f9 /config-db/slxconfig-demuxer
parent* removed 'nbd' from supported export types as I have learned from Dirk yeste... (diff)
downloadcore-03db5fcadee81bd5ce66665f18b611e106783c27.tar.gz
core-03db5fcadee81bd5ce66665f18b611e106783c27.tar.xz
core-03db5fcadee81bd5ce66665f18b611e106783c27.zip
* largish overhaul, changed ConfigDB to be object-oriented (could be improved, though!)
* slxos-setup, slxos-export, slxconfig and slxconfig-demuxer can now be run one after the other in order to get a complete setup * still problems when trying to boot that system here, need to investigate... git-svn-id: http://svn.openslx.org/svn/openslx/trunk@774 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/slxconfig-demuxer')
-rwxr-xr-xconfig-db/slxconfig-demuxer36
1 files changed, 19 insertions, 17 deletions
diff --git a/config-db/slxconfig-demuxer b/config-db/slxconfig-demuxer
index a92f4c84..b35489cd 100755
--- a/config-db/slxconfig-demuxer
+++ b/config-db/slxconfig-demuxer
@@ -36,7 +36,7 @@ use lib "$FindBin::RealBin";
# development path to config-db stuff
use OpenSLX::Basics;
-use OpenSLX::ConfigDB qw(:access :aggregation :support);
+use OpenSLX::ConfigDB qw(:support);
my $pxeConfigDefaultTemplate = q[# generated by openslx
NOESCAPE 0
@@ -81,9 +81,10 @@ if ($versionReq) {
openslxInit();
-my $openslxDB = connectConfigDB();
+my $openslxDB = OpenSLX::ConfigDB->new();
+$openslxDB->connect();
-my $settings = fetchSettings($openslxDB);
+my $settings = $openslxDB->fetchSettings();
my $clientConfigPath = "$openslxConfig{'private-path'}/config";
if (!-d $clientConfigPath) {
@@ -113,7 +114,7 @@ writeConfigurations();
my $wr = ($dryRun ? "would have written" : "wrote");
print "$wr $systemConfCount systems and $clientSystemConfCount client-configurations to $tftpbootPath/client-config\n";
-disconnectConfigDB($openslxDB);
+$openslxDB->disconnect();
system("rm -rf $tempPath") unless $dryRun || length($tempPath) < 12;
@@ -253,7 +254,7 @@ sub writePXEMenus
system(qq[cp -p "$menuc32Path" $pxePath/]);
}
- my @clients = fetchClientsByFilter($openslxDB);
+ my @clients = $openslxDB->fetchClientByFilter();
foreach my $client (@clients) {
my $externalClientID = externalIDForClient($client);
my $pxeFile = "$pxeConfigPath/$externalClientID";
@@ -261,10 +262,10 @@ sub writePXEMenus
vlog 1, _tr("writing PXE-file %s", $pxeFile);
open(PXE, "> $pxeFile") or die "unable to write to $pxeFile";
print PXE $pxeConfigDefaultTemplate;
- my @systemIDs = aggregatedSystemIDsOfClient($openslxDB, $client);
- my @systems = fetchSystemsByID($openslxDB, \@systemIDs);
+ my @systemIDs = $openslxDB->aggregatedSystemIDsOfClient($client);
+ my @systems = $openslxDB->fetchSystemByID(\@systemIDs);
foreach my $system (@systems) {
- my @infos = aggregatedSystemFileInfosOfSystem($openslxDB, $system);
+ my @infos = $openslxDB->aggregatedSystemFileInfosOfSystem($system);
foreach my $info (@infos) {
my $extSysID = externalIDForSystem($info);
my $append = $system->{kernel_params};
@@ -308,7 +309,7 @@ sub generateInitalRamFS
$cmd .= qq[-f "$setup->{ramfs_fsmods}" ];
}
my $rootPath
- = "$openslxConfig{'stage1-path'}/$vendorOS->{path}";
+ = "$openslxConfig{'stage1-path'}/$vendorOS->{name}";
$cmd .= "-i $pxeSysPath/initramfs -r $rootPath ";
# fill slxConf-hash...
@@ -346,8 +347,9 @@ sub writeSystemPXEFiles
my $pxePath = "$tftpbootPath/pxe";
- my $vendorOS = fetchVendorOSesByID($openslxDB, $system->{vendor_os_id});
- my @infos = aggregatedSystemFileInfosOfSystem($openslxDB, $system);
+ my $export = $openslxDB->fetchExportByID($system->{export_id});
+ my $vendorOS = $openslxDB->fetchVendorOSByID($export->{vendor_os_id});
+ my @infos = $openslxDB->aggregatedSystemFileInfosOfSystem($system);
foreach my $info (@infos) {
my $kernelFile = $info->{'kernel-file'};
my $extSysID = externalIDForSystem($info);
@@ -371,7 +373,7 @@ sub writeDhcpConfig
die _tr("unable to load DHCP-Export backend '%s'! (%s)\n", $dhcpModule, $@);
}
my $dhcpBackend = $dhcpModule->new();
- my @clients = fetchClientsByFilter($openslxDB);
+ my @clients = $openslxDB->fetchClientByFilter();
$dhcpBackend->execute(\@clients);
}
@@ -381,15 +383,15 @@ sub writeClientConfigurationsForSystem
my $buildPath = shift;
my $attrFile = shift;
- my @clientIDs = aggregatedClientIDsOfSystem($openslxDB, $system);
- my @clients = fetchClientsByID($openslxDB, \@clientIDs);
+ my @clientIDs = $openslxDB->aggregatedClientIDsOfSystem($system);
+ my @clients = $openslxDB->fetchClientByID(\@clientIDs);
foreach my $client (@clients) {
vlog 2, _tr("exporting client %d:%s", $client->{id}, $client->{name});
$clientSystemConfCount++;
# merge configurations of client, it's groups, default client and
# system and write the resulting attributes to a configuration file:
- mergeDefaultAndGroupAttributesIntoClient($openslxDB, $client);
+ $openslxDB->mergeDefaultAndGroupAttributesIntoClient($client);
mergeAttributes($client, $system);
writeAttributesToFile($client, $attrFile);
@@ -404,7 +406,7 @@ sub writeClientConfigurationsForSystem
sub writeSystemConfigurations
{
- my @systems = fetchSystemsByFilter($openslxDB);
+ my @systems = $openslxDB->fetchSystemByFilter();
foreach my $system (@systems) {
next unless $system->{id} > 0;
@@ -415,7 +417,7 @@ sub writeSystemConfigurations
copyExternalSystemConfig($system->{name}, $buildPath);
my $attrFile = "$buildPath/initramfs/machine-setup";
- mergeDefaultAttributesIntoSystem($openslxDB, $system);
+ $openslxDB->mergeDefaultAttributesIntoSystem($system);
writeAttributesToFile($system, $attrFile);
my $externalSystemID = externalIDForSystem($system);