summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Tappe2007-03-15 22:41:10 +0100
committerOliver Tappe2007-03-15 22:41:10 +0100
commit03db5fcadee81bd5ce66665f18b611e106783c27 (patch)
tree1071ff956228157c52fbd5b5087ca8928b37d0f9
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
-rw-r--r--config-db/OpenSLX/ConfigDB.pm514
-rw-r--r--config-db/OpenSLX/DBSchema.pm77
-rw-r--r--config-db/OpenSLX/MetaDB/Base.pm256
-rw-r--r--config-db/OpenSLX/MetaDB/CSV.pm2
-rw-r--r--config-db/OpenSLX/MetaDB/DBI.pm136
-rw-r--r--config-db/OpenSLX/MetaDB/SQLite.pm2
-rw-r--r--config-db/OpenSLX/MetaDB/mysql.pm2
-rwxr-xr-xconfig-db/devel-tools/create-simple-db.pl67
-rwxr-xr-xconfig-db/devel-tools/test-config-db.pl5
-rwxr-xr-xconfig-db/devel-tools/test-config-demuxer.pl3
-rwxr-xr-xconfig-db/slxconfig84
-rwxr-xr-xconfig-db/slxconfig-demuxer36
-rw-r--r--installer/OpenSLX/OSExport/Engine.pm46
-rw-r--r--installer/OpenSLX/OSExport/ExportType/NFS.pm4
-rw-r--r--installer/OpenSLX/OSSetup/Engine.pm69
-rwxr-xr-xinstaller/slxos-setup4
-rw-r--r--lib/OpenSLX/Basics.pm19
-rw-r--r--lib/OpenSLX/Utils.pm1
18 files changed, 677 insertions, 650 deletions
diff --git a/config-db/OpenSLX/ConfigDB.pm b/config-db/OpenSLX/ConfigDB.pm
index fce953b6..b3606e9d 100644
--- a/config-db/OpenSLX/ConfigDB.pm
+++ b/config-db/OpenSLX/ConfigDB.pm
@@ -23,60 +23,20 @@ $VERSION = 1.01; # API-version . implementation-version
### - data aggregation methods (combining data in ways useful for apps)
### - support methods
################################################################################
+
use Exporter;
@ISA = qw(Exporter);
-my @accessExports = qw(
- connectConfigDB disconnectConfigDB
- fetchVendorOSesByFilter fetchVendorOSesByID fetchVendorOSIDsOfSystem
- fetchSystemsByFilter fetchSystemsByID fetchSystemIDsOfClient
- fetchSystemIDsOfGroup
- fetchSystemsVariantByFilter fetchSystemVariantsByID
- fetchSystemVariantIDsOfSystem
- fetchClientsByFilter fetchClientsByID fetchClientIDsOfSystem
- fetchClientIDsOfGroup
- fetchGroupsByFilter fetchGroupsByID fetchGroupIDsOfClient
- fetchGroupIDsOfSystem
- fetchSettings
-);
-
-my @manipulationExports = qw(
- addVendorOS removeVendorOS changeVendorOS
- addSystem removeSystem changeSystem
- setClientIDsOfSystem addClientIDsToSystem removeClientIDsFromSystem
- setGroupIDsOfSystem addGroupIDsToSystem removeGroupIDsFromSystem
- addSystemVariant removeSystemVariant changeSystemVariant
- removeSystemVariantIDsFromSystem
- addClient removeClient changeClient
- setSystemIDsOfClient addSystemIDsToClient removeSystemIDsFromClient
- setGroupIDsOfClient addGroupIDsToClient removeGroupIDsFromClient
- addGroup removeGroup changeGroup
- setClientIDsOfGroup addClientIDsToGroup removeClientIDsFromGroup
- setSystemIDsOfGroup addSystemIDsToGroup removeSystemIDsFromGroup
- changeSettings
- emptyDatabase
-);
-
-my @aggregationExports = qw(
- mergeDefaultAttributesIntoSystem
- mergeDefaultAndGroupAttributesIntoClient
- aggregatedSystemIDsOfClient aggregatedClientIDsOfSystem
- aggregatedSystemFileInfosOfSystem
-);
-
my @supportExports = qw(
- isAttribute mergeAttributes
- externalIDForSystem externalIDForClient
- externalAttrName generatePlaceholderFor
+ isAttribute mergeAttributes
+ externalIDForSystem externalIDForClient
+ externalAttrName generatePlaceholderFor
);
-@EXPORT = @accessExports;
-@EXPORT_OK = (@manipulationExports, @aggregationExports, @supportExports);
+@EXPORT = ();
+@EXPORT_OK = (@supportExports);
%EXPORT_TAGS = (
- 'access' => [ @accessExports ],
- 'manipulation' => [ @manipulationExports ],
- 'aggregation' => [ @aggregationExports ],
- 'support' => [ @supportExports ],
+ 'support' => [ @supportExports ],
);
################################################################################
@@ -167,8 +127,16 @@ sub _uniqueByKey
################################################################################
### data access interface
################################################################################
-sub connectConfigDB
+sub new
{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub connect
+{
+ my $self = shift;
my $dbParams = shift;
# hash-ref with any additional info that might be required by
# specific metadb-module (not used yet)
@@ -189,204 +157,198 @@ sub connectConfigDB
confess _tr('Could not load module <%s> (Version <%s> required, but <%s> found)',
$dbModule, $VERSION, $modVersion);
}
- $dbModule->import;
-
my $metaDB = $dbModule->new();
- $metaDB->connectConfigDB($dbParams);
- my $confDB = {
- 'db-type' => $dbType,
- 'meta-db' => $metaDB,
- };
+ $metaDB->connect($dbParams);
+ $self->{'db-type'} = $dbType;
+ $self->{'meta-db'} = $metaDB;
foreach my $tk (keys %{$DbSchema->{tables}}) {
$metaDB->schemaDeclareTable($tk, $DbSchema->{tables}->{$tk});
}
_checkAndUpgradeDBSchemaIfNecessary($metaDB);
-
- return $confDB;
}
-sub disconnectConfigDB
+sub disconnect
{
- my $confDB = shift;
+ my $self = shift;
- $confDB->{'meta-db'}->disconnectConfigDB();
+ $self->{'meta-db'}->disconnect();
}
-sub fetchVendorOSesByFilter
+sub fetchVendorOSByFilter
{
- my $confDB = shift;
+ my $self = shift;
my $filter = shift;
my $resultCols = shift;
- my @vendorOSes
- = $confDB->{'meta-db'}->fetchVendorOSesByFilter($filter, $resultCols);
- return wantarray() ? @vendorOSes : shift @vendorOSes;
+ my @vendorOS
+ = $self->{'meta-db'}->fetchVendorOSByFilter($filter, $resultCols);
+ return wantarray() ? @vendorOS : shift @vendorOS;
}
-sub fetchVendorOSesByID
+sub fetchVendorOSByID
{
- my $confDB = shift;
+ my $self = shift;
my $ids = _aref(shift);
my $resultCols = shift;
- my @vendorOSes
- = $confDB->{'meta-db'}->fetchVendorOSesByID($ids, $resultCols);
- return wantarray() ? @vendorOSes : shift @vendorOSes;
+ my @vendorOS
+ = $self->{'meta-db'}->fetchVendorOSByID($ids, $resultCols);
+ return wantarray() ? @vendorOS : shift @vendorOS;
}
-sub fetchSystemsByFilter
+sub fetchExportByFilter
{
- my $confDB = shift;
+ my $self = shift;
my $filter = shift;
my $resultCols = shift;
- my @systems
- = $confDB->{'meta-db'}->fetchSystemsByFilter($filter, $resultCols);
- return wantarray() ? @systems : shift @systems;
+ my @exports
+ = $self->{'meta-db'}->fetchExportByFilter($filter, $resultCols);
+ return wantarray() ? @exports : shift @exports;
}
-sub fetchSystemsByID
+sub fetchExportByID
{
- my $confDB = shift;
+ my $self = shift;
my $ids = _aref(shift);
my $resultCols = shift;
- my @systems = $confDB->{'meta-db'}->fetchSystemsByID($ids, $resultCols);
- return wantarray() ? @systems : shift @systems;
+ my @exports
+ = $self->{'meta-db'}->fetchExportByID($ids, $resultCols);
+ return wantarray() ? @exports : shift @exports;
}
-sub fetchSystemIDsOfVendorOS
+sub fetchExportIDsOfVendorOS
{
- my $confDB = shift;
+ my $self = shift;
my $vendorOSID = shift;
- return $confDB->{'meta-db'}->fetchSystemIDsOfVendorOS($vendorOSID);
+ return $self->{'meta-db'}->fetchExportIDsOfVendorOS($vendorOSID);
}
-sub fetchSystemIDsOfClient
+sub fetchSystemByFilter
{
- my $confDB = shift;
- my $clientID = shift;
+ my $self = shift;
+ my $filter = shift;
+ my $resultCols = shift;
- return $confDB->{'meta-db'}->fetchSystemIDsOfClient($clientID);
+ my @systems
+ = $self->{'meta-db'}->fetchSystemByFilter($filter, $resultCols);
+ return wantarray() ? @systems : shift @systems;
}
-sub fetchSystemIDsOfGroup
+sub fetchSystemByID
{
- my $confDB = shift;
- my $groupID = shift;
+ my $self = shift;
+ my $ids = _aref(shift);
+ my $resultCols = shift;
- return $confDB->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
+ my @systems = $self->{'meta-db'}->fetchSystemByID($ids, $resultCols);
+ return wantarray() ? @systems : shift @systems;
}
-sub fetchSystemVariantsByFilter
+sub fetchSystemIDsOfExport
{
- my $confDB = shift;
- my $filter = shift;
- my $resultCols = shift;
+ my $self = shift;
+ my $exportID = shift;
- my @systemVariants
- = $confDB->{'meta-db'}->fetchSystemVariantsByFilter($filter, $resultCols);
- return wantarray() ? @systemVariants : shift @systemVariants;
+ return $self->{'meta-db'}->fetchSystemIDsOfExport($exportID);
}
-sub fetchSystemVariantsByID
+sub fetchSystemIDsOfClient
{
- my $confDB = shift;
- my $ids = _aref(shift);
- my $resultCols = shift;
+ my $self = shift;
+ my $clientID = shift;
- my @systemVariants
- = $confDB->{'meta-db'}->fetchSystemVariantsByID($ids, $resultCols);
- return wantarray() ? @systemVariants : shift @systemVariants;
+ return $self->{'meta-db'}->fetchSystemIDsOfClient($clientID);
}
-sub fetchSystemVariantIDsOfSystem
+sub fetchSystemIDsOfGroup
{
- my $confDB = shift;
- my $systemID = shift;
+ my $self = shift;
+ my $groupID = shift;
- return $confDB->{'meta-db'}->fetchSystemVariantIDsOfSystem($systemID);
+ return $self->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
}
-sub fetchClientsByFilter
+sub fetchClientByFilter
{
- my $confDB = shift;
+ my $self = shift;
my $filter = shift;
- my @clients = $confDB->{'meta-db'}->fetchClientsByFilter($filter);
+ my @clients = $self->{'meta-db'}->fetchClientByFilter($filter);
return wantarray() ? @clients : shift @clients;
}
-sub fetchClientsByID
+sub fetchClientByID
{
- my $confDB = shift;
+ my $self = shift;
my $ids = _aref(shift);
my $resultCols = shift;
- my @clients = $confDB->{'meta-db'}->fetchClientsByID($ids, $resultCols);
+ my @clients = $self->{'meta-db'}->fetchClientByID($ids, $resultCols);
return wantarray() ? @clients : shift @clients;
}
sub fetchClientIDsOfSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
- return $confDB->{'meta-db'}->fetchClientIDsOfSystem($systemID);
+ return $self->{'meta-db'}->fetchClientIDsOfSystem($systemID);
}
sub fetchClientIDsOfGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
- return $confDB->{'meta-db'}->fetchClientIDsOfGroup($groupID);
+ return $self->{'meta-db'}->fetchClientIDsOfGroup($groupID);
}
-sub fetchGroupsByFilter
+sub fetchGroupByFilter
{
- my $confDB = shift;
+ my $self = shift;
my $filter = shift;
my $resultCols = shift;
my @groups
- = $confDB->{'meta-db'}->fetchGroupsByFilter($filter, $resultCols);
+ = $self->{'meta-db'}->fetchGroupByFilter($filter, $resultCols);
return wantarray() ? @groups : shift @groups;
}
-sub fetchGroupsByID
+sub fetchGroupByID
{
- my $confDB = shift;
+ my $self = shift;
my $ids = _aref(shift);
my $resultCols = shift;
- my @groups = $confDB->{'meta-db'}->fetchGroupsByID($ids, $resultCols);
+ my @groups = $self->{'meta-db'}->fetchGroupByID($ids, $resultCols);
return wantarray() ? @groups : shift @groups;
}
sub fetchGroupIDsOfSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
- return $confDB->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
+ return $self->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
}
sub fetchGroupIDsOfClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
- return $confDB->{'meta-db'}->fetchGroupIDsOfClient($clientID);
+ return $self->{'meta-db'}->fetchGroupIDsOfClient($clientID);
}
sub fetchSettings
{
- my $confDB = shift;
+ my $self = shift;
- my @rows = $confDB->{'meta-db'}->fetchSettings();
+ my @rows = $self->{'meta-db'}->fetchSettings();
return shift @rows;
}
@@ -395,84 +357,109 @@ sub fetchSettings
################################################################################
sub addVendorOS
{
- my $confDB = shift;
+ my $self = shift;
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->addVendorOS($valRows);
+ return $self->{'meta-db'}->addVendorOS($valRows);
}
sub removeVendorOS
{
- my $confDB = shift;
+ my $self = shift;
my $vendorOSIDs = _aref(shift);
- return $confDB->{'meta-db'}->removeVendorOS($vendorOSIDs);
+ return $self->{'meta-db'}->removeVendorOS($vendorOSIDs);
}
sub changeVendorOS
{
- my $confDB = shift;
+ my $self = shift;
my $vendorOSIDs = _aref(shift);
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->changeVendorOS($vendorOSIDs, $valRows);
+ return $self->{'meta-db'}->changeVendorOS($vendorOSIDs, $valRows);
+}
+
+sub addExport
+{
+ my $self = shift;
+ my $valRows = _aref(shift);
+
+ return $self->{'meta-db'}->addExport($valRows);
+}
+
+sub removeExport
+{
+ my $self = shift;
+ my $exportIDs = _aref(shift);
+
+ return $self->{'meta-db'}->removeExport($exportIDs);
+}
+
+sub changeExport
+{
+ my $self = shift;
+ my $exportIDs = _aref(shift);
+ my $valRows = _aref(shift);
+
+ return $self->{'meta-db'}->changeExport($exportIDs, $valRows);
}
sub addSystem
{
- my $confDB = shift;
+ my $self = shift;
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->addSystem($valRows);
+ return $self->{'meta-db'}->addSystem($valRows);
}
sub removeSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemIDs = _aref(shift);
foreach my $system (@$systemIDs) {
- setGroupIDsOfSystem($confDB, $system);
- setClientIDsOfSystem($confDB, $system);
+ $self->setGroupIDsOfSystem($system);
+ $self->setClientIDsOfSystem($system);
}
- return $confDB->{'meta-db'}->removeSystem($systemIDs);
+ return $self->{'meta-db'}->removeSystem($systemIDs);
}
sub changeSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemIDs = _aref(shift);
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->changeSystem($systemIDs, $valRows);
+ return $self->{'meta-db'}->changeSystem($systemIDs, $valRows);
}
sub setClientIDsOfSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $clientIDs = _aref(shift);
my @uniqueClientIDs = _unique(@$clientIDs);
- return $confDB->{'meta-db'}->setClientIDsOfSystem($systemID,
+ return $self->{'meta-db'}->setClientIDsOfSystem($systemID,
\@uniqueClientIDs);
}
sub addClientIDsToSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $newClientIDs = _aref(shift);
- my @clientIDs = $confDB->{'meta-db'}->fetchClientIDsOfSystem($systemID);
+ my @clientIDs = $self->{'meta-db'}->fetchClientIDsOfSystem($systemID);
push @clientIDs, @$newClientIDs;
- return setClientIDsOfSystem($confDB, $systemID, \@clientIDs);
+ return $self->setClientIDsOfSystem($systemID, \@clientIDs);
}
sub removeClientIDsFromSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $removedClientIDs = _aref(shift);
@@ -480,35 +467,35 @@ sub removeClientIDsFromSystem
@toBeRemoved{@$removedClientIDs} = ();
my @clientIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchClientIDsOfSystem($systemID);
- return setClientIDsOfSystem($confDB, $systemID, \@clientIDs);
+ $self->{'meta-db'}->fetchClientIDsOfSystem($systemID);
+ return $self->setClientIDsOfSystem($systemID, \@clientIDs);
}
sub setGroupIDsOfSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $groupIDs = _aref(shift);
my @uniqueGroupIDs = _unique(@$groupIDs);
- return $confDB->{'meta-db'}->setGroupIDsOfSystem($systemID,
+ return $self->{'meta-db'}->setGroupIDsOfSystem($systemID,
\@uniqueGroupIDs);
}
sub addGroupIDsToSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $newGroupIDs = _aref(shift);
- my @groupIDs = $confDB->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
+ my @groupIDs = $self->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
push @groupIDs, @$newGroupIDs;
- return setGroupIDsOfSystem($confDB, $systemID, \@groupIDs);
+ return $self->setGroupIDsOfSystem($systemID, \@groupIDs);
}
sub removeGroupIDsFromSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $toBeRemovedGroupIDs = _aref(shift);
@@ -516,90 +503,65 @@ sub removeGroupIDsFromSystem
@toBeRemoved{@$toBeRemovedGroupIDs} = ();
my @groupIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
- return setGroupIDsOfSystem($confDB, $systemID, \@groupIDs);
-}
-
-sub addSystemVariant
-{
- my $confDB = shift;
- my $valRows = _aref(shift);
-
- return $confDB->{'meta-db'}->addSystemVariant($valRows);
-}
-
-sub removeSystemVariant
-{
- my $confDB = shift;
- my $systemVariantIDs = _aref(shift);
-
- return $confDB->{'meta-db'}->removeSystemVariant($systemVariantIDs);
-}
-
-sub changeSystemVariant
-{
- my $confDB = shift;
- my $systemVariantIDs = _aref(shift);
- my $valRows = _aref(shift);
-
- return $confDB->{'meta-db'}->changeSystemVariant($systemVariantIDs, $valRows);
+ $self->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
+ return $self->setGroupIDsOfSystem($systemID, \@groupIDs);
}
sub addClient
{
- my $confDB = shift;
+ my $self = shift;
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->addClient($valRows);
+ return $self->{'meta-db'}->addClient($valRows);
}
sub removeClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientIDs = _aref(shift);
foreach my $client (@$clientIDs) {
- setGroupIDsOfClient($confDB, $client);
- setSystemIDsOfClient($confDB, $client);
+ $self->setGroupIDsOfClient($client);
+ $self->setSystemIDsOfClient($client);
}
- return $confDB->{'meta-db'}->removeClient($clientIDs);
+ return $self->{'meta-db'}->removeClient($clientIDs);
}
sub changeClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientIDs = _aref(shift);
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->changeClient($clientIDs, $valRows);
+ return $self->{'meta-db'}->changeClient($clientIDs, $valRows);
}
sub setSystemIDsOfClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $systemIDs = _aref(shift);
my @uniqueSystemIDs = _unique(@$systemIDs);
- return $confDB->{'meta-db'}->setSystemIDsOfClient($clientID,
+ return $self->{'meta-db'}->setSystemIDsOfClient($clientID,
\@uniqueSystemIDs);
}
sub addSystemIDsToClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $newSystemIDs = _aref(shift);
- my @systemIDs = $confDB->{'meta-db'}->fetchSystemIDsOfClient($clientID);
+ my @systemIDs = $self->{'meta-db'}->fetchSystemIDsOfClient($clientID);
push @systemIDs, @$newSystemIDs;
- return setSystemIDsOfClient($confDB, $clientID, \@systemIDs);
+ return $self->setSystemIDsOfClient($clientID, \@systemIDs);
}
sub removeSystemIDsFromClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $removedSystemIDs = _aref(shift);
@@ -607,35 +569,35 @@ sub removeSystemIDsFromClient
@toBeRemoved{@$removedSystemIDs} = ();
my @systemIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchSystemIDsOfClient($clientID);
- return setSystemIDsOfClient($confDB, $clientID, \@systemIDs);
+ $self->{'meta-db'}->fetchSystemIDsOfClient($clientID);
+ return $self->setSystemIDsOfClient($clientID, \@systemIDs);
}
sub setGroupIDsOfClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $groupIDs = _aref(shift);
my @uniqueGroupIDs = _unique(@$groupIDs);
- return $confDB->{'meta-db'}->setGroupIDsOfClient($clientID,
+ return $self->{'meta-db'}->setGroupIDsOfClient($clientID,
\@uniqueGroupIDs);
}
sub addGroupIDsToClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $newGroupIDs = _aref(shift);
- my @groupIDs = $confDB->{'meta-db'}->fetchGroupIDsOfClient($clientID);
+ my @groupIDs = $self->{'meta-db'}->fetchGroupIDsOfClient($clientID);
push @groupIDs, @$newGroupIDs;
- return setGroupIDsOfClient($confDB, $clientID, \@groupIDs);
+ return $self->setGroupIDsOfClient($clientID, \@groupIDs);
}
sub removeGroupIDsFromClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $toBeRemovedGroupIDs = _aref(shift);
@@ -643,65 +605,65 @@ sub removeGroupIDsFromClient
@toBeRemoved{@$toBeRemovedGroupIDs} = ();
my @groupIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchGroupIDsOfClient($clientID);
- return setGroupIDsOfClient($confDB, $clientID, \@groupIDs);
+ $self->{'meta-db'}->fetchGroupIDsOfClient($clientID);
+ return $self->setGroupIDsOfClient($clientID, \@groupIDs);
}
sub addGroup
{
- my $confDB = shift;
+ my $self = shift;
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->addGroup($valRows);
+ return $self->{'meta-db'}->addGroup($valRows);
}
sub removeGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupIDs = _aref(shift);
foreach my $group (@$groupIDs) {
- setSystemIDsOfGroup($confDB, $group, []);
- setClientIDsOfGroup($confDB, $group, []);
+ $self->setSystemIDsOfGroup($group, []);
+ $self->setClientIDsOfGroup($group, []);
}
- return $confDB->{'meta-db'}->removeGroup($groupIDs);
+ return $self->{'meta-db'}->removeGroup($groupIDs);
}
sub changeGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupIDs = _aref(shift);
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->changeGroup($groupIDs, $valRows);
+ return $self->{'meta-db'}->changeGroup($groupIDs, $valRows);
}
sub setClientIDsOfGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $clientIDs = _aref(shift);
my @uniqueClientIDs = _unique(@$clientIDs);
- return $confDB->{'meta-db'}->setClientIDsOfGroup($groupID,
+ return $self->{'meta-db'}->setClientIDsOfGroup($groupID,
\@uniqueClientIDs);
}
sub addClientIDsToGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $newClientIDs = _aref(shift);
- my @clientIDs = $confDB->{'meta-db'}->fetchClientIDsOfGroup($groupID);
+ my @clientIDs = $self->{'meta-db'}->fetchClientIDsOfGroup($groupID);
push @clientIDs, @$newClientIDs;
- return setClientIDsOfGroup($confDB, $groupID, \@clientIDs);
+ return $self->setClientIDsOfGroup($groupID, \@clientIDs);
}
sub removeClientIDsFromGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $removedClientIDs = _aref(shift);
@@ -709,35 +671,35 @@ sub removeClientIDsFromGroup
@toBeRemoved{@$removedClientIDs} = ();
my @clientIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchClientIDsOfGroup($groupID);
- return setClientIDsOfGroup($confDB, $groupID, \@clientIDs);
+ $self->{'meta-db'}->fetchClientIDsOfGroup($groupID);
+ return $self->setClientIDsOfGroup($groupID, \@clientIDs);
}
sub setSystemIDsOfGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $systemIDs = _aref(shift);
my @uniqueSystemIDs = _unique(@$systemIDs);
- return $confDB->{'meta-db'}->setSystemIDsOfGroup($groupID,
+ return $self->{'meta-db'}->setSystemIDsOfGroup($groupID,
\@uniqueSystemIDs);
}
sub addSystemIDsToGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $newSystemIDs = _aref(shift);
- my @systemIDs = $confDB->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
+ my @systemIDs = $self->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
push @systemIDs, @$newSystemIDs;
- return setSystemIDsOfGroup($confDB, $groupID, \@systemIDs);
+ return $self->setSystemIDsOfGroup($groupID, \@systemIDs);
}
sub removeSystemIDsFromGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $removedSystemIDs = _aref(shift);
@@ -745,50 +707,50 @@ sub removeSystemIDsFromGroup
@toBeRemoved{@$removedSystemIDs} = ();
my @systemIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
- return setSystemIDsOfGroup($confDB, $groupID, \@systemIDs);
+ $self->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
+ return $self->setSystemIDsOfGroup($groupID, \@systemIDs);
}
sub emptyDatabase
{ # clears all user-data from the database
- my $confDB = shift;
+ my $self = shift;
my @groupIDs
= map { $_->{id} }
- fetchGroupsByFilter($confDB);
- removeGroup($confDB, \@groupIDs);
+ $self->fetchGroupByFilter();
+ $self->removeGroup(\@groupIDs);
my @clientIDs
= map { $_->{id} }
grep { $_->{id} > 0 }
- fetchClientsByFilter($confDB);
- removeClient($confDB, \@clientIDs);
+ $self->fetchClientByFilter();
+ $self->removeClient(\@clientIDs);
- my @sysVarIDs
+ my @sysIDs
= map { $_->{id} }
grep { $_->{id} > 0 }
- fetchSystemVariantsByFilter($confDB);
- removeSystemVariant($confDB, \@sysVarIDs);
+ $self->fetchSystemByFilter();
+ $self->removeSystem(\@sysIDs);
- my @sysIDs
+ my @exportIDs
= map { $_->{id} }
grep { $_->{id} > 0 }
- fetchSystemsByFilter($confDB);
- removeSystem($confDB, \@sysIDs);
+ $self->fetchExportByFilter();
+ $self->removeExport(\@exportIDs);
my @vendorOSIDs
= map { $_->{id} }
grep { $_->{id} > 0 }
- fetchVendorOSesByFilter($confDB);
- removeVendorOS($confDB, \@vendorOSIDs);
+ $self->fetchVendorOSByFilter();
+ $self->removeVendorOS(\@vendorOSIDs);
}
sub changeSettings
{
- my $confDB = shift;
+ my $self = shift;
my $settings = shift;
- return $confDB->{'meta-db'}->changeSettings($settings);
+ return $self->{'meta-db'}->changeSettings($settings);
}
################################################################################
@@ -796,11 +758,11 @@ sub changeSettings
################################################################################
sub mergeDefaultAttributesIntoSystem
{ # merge default system configuration into given system
- my $confDB = shift;
+ my $self = shift;
my $system = shift;
my $defaultSystem = shift;
- $defaultSystem = fetchSystemsByID($confDB, 0)
+ $defaultSystem = $self->fetchSystemByID(0)
unless defined $defaultSystem;
mergeAttributes($system, $defaultSystem);
@@ -808,14 +770,14 @@ sub mergeDefaultAttributesIntoSystem
sub mergeDefaultAndGroupAttributesIntoClient
{ # merge default and group configurations into given client
- my $confDB = shift;
+ my $self = shift;
my $client = shift;
# step over all groups this client belongs to
# (ordered by priority from highest to lowest):
- my @groupIDs = fetchGroupIDsOfClient($confDB, $client->{id});
+ my @groupIDs = $self->fetchGroupIDsOfClient($client->{id});
my @groups = sort { $b->{priority} <=> $a->{priority} }
- fetchGroupsByID($confDB, \@groupIDs);
+ $self->fetchGroupByID(\@groupIDs);
foreach my $group (@groups) {
# merge configuration from this group into the current client:
vlog 3, _tr('merging from group %d:%s...', $group->{id}, $group->{name});
@@ -824,29 +786,29 @@ sub mergeDefaultAndGroupAttributesIntoClient
# merge configuration from default client:
vlog 3, _tr('merging from default client...');
- my $defaultClient = fetchClientsByID($confDB, 0);
+ my $defaultClient = $self->fetchClientByID(0);
mergeAttributes($client, $defaultClient);
}
sub aggregatedSystemIDsOfClient
{ # return aggregated list of system-IDs this client should offer
# (as indicated by itself, the default client and the client's groups)
- my $confDB = shift;
+ my $self = shift;
my $client = shift;
# add all systems directly linked to client:
- my @systemIDs = fetchSystemIDsOfClient($confDB, $client->{id});
+ my @systemIDs = $self->fetchSystemIDsOfClient($client->{id});
# step over all groups this client belongs to:
- my @groupIDs = fetchGroupIDsOfClient($confDB, $client->{id});
- my @groups = fetchGroupsByID($confDB, \@groupIDs);
+ my @groupIDs = $self->fetchGroupIDsOfClient($client->{id});
+ my @groups = $self->fetchGroupByID(\@groupIDs);
foreach my $group (@groups) {
# add all systems that the client inherits from the current group:
- push @systemIDs, fetchSystemIDsOfGroup($confDB, $group->{id});
+ push @systemIDs, $self->fetchSystemIDsOfGroup($group->{id});
}
# add all systems inherited from default client
- push @systemIDs, fetchSystemIDsOfClient($confDB, 0);
+ push @systemIDs, $self->fetchSystemIDsOfClient(0);
return _unique(@systemIDs);
}
@@ -854,22 +816,22 @@ sub aggregatedSystemIDsOfClient
sub aggregatedClientIDsOfSystem
{ # return aggregated list of client-IDs this system is linked to
# (as indicated by itself, the default system and the system's groups)
- my $confDB = shift;
+ my $self = shift;
my $system = shift;
# add all clients directly linked to system:
- my @clientIDs = fetchClientIDsOfSystem($confDB, $system->{id});
+ my @clientIDs = $self->fetchClientIDsOfSystem($system->{id});
# step over all groups this system belongs to:
- my @groupIDs = fetchGroupIDsOfSystem($confDB, $system->{id});
- my @groups = fetchGroupsByID($confDB, \@groupIDs);
+ my @groupIDs = $self->fetchGroupIDsOfSystem($system->{id});
+ my @groups = $self->fetchGroupByID(\@groupIDs);
foreach my $group (@groups) {
# add all clients that the system inherits from the current group:
- push @clientIDs, fetchClientIDsOfGroup($confDB, $group->{id});
+ push @clientIDs, $self->fetchClientIDsOfGroup($group->{id});
}
# add all clients inherited from default system
- push @clientIDs, fetchClientIDsOfSystem($confDB, 0);
+ push @clientIDs, $self->fetchClientIDsOfSystem(0);
return _unique(@clientIDs);
}
@@ -877,14 +839,15 @@ sub aggregatedClientIDsOfSystem
sub aggregatedSystemFileInfosOfSystem
{ # return aggregated list of hash-refs that contain information about
# the kernel- and initialramfs-files this system is using
- # (as indicated by itself and the system's variants)
- my $confDB = shift;
+ my $self = shift;
my $system = shift;
- my $vendorOS = fetchVendorOSesByID($confDB, $system->{vendor_os_id});
- return () if !$vendorOS || !length($vendorOS->{path});
+ my $export = $self->fetchExportByID($system->{export_id});
+ return () if !$export || !length($export->{name});
+ my $vendorOS = $self->fetchVendorOSByID($export->{vendor_os_id});
+ return () if !$vendorOS || !length($vendorOS->{name});
my $kernelPath
- = "$openslxConfig{'private-path'}/stage1/$vendorOS->{path}";
+ = "$openslxConfig{'private-path'}/stage1/$vendorOS->{name}/boot";
my $exportURI = $system->{'export_uri'};
if ($exportURI !~ m[\w]) {
@@ -892,14 +855,11 @@ sub aggregatedSystemFileInfosOfSystem
my $type = $system->{'export_type'};
my $serverIpToken = generatePlaceholderFor('serverip');
$exportURI
- = "$type://$serverIpToken$openslxConfig{'export-path'}/$type/$vendorOS->{path}";
+ = "$type://$serverIpToken$openslxConfig{'export-path'}/$type/$vendorOS->{name}";
}
- my @variantIDs = fetchSystemVariantIDsOfSystem($confDB, $system->{id});
- my @variants = fetchSystemVariantsByID($confDB, \@variantIDs);
-
my @infos;
- foreach my $sys ($system, @variants) {
+ foreach my $sys ($system) {
next if !length($sys->{kernel});
my %info = %$sys;
$info{'kernel-file'} = "$kernelPath/$sys->{kernel}";
@@ -921,7 +881,7 @@ sub isAttribute
{ # returns whether or not the given key is an exportable attribute
my $key = shift;
- return $key =~ m[^attr];
+ return $key =~ m[^attr_];
}
sub mergeAttributes
diff --git a/config-db/OpenSLX/DBSchema.pm b/config-db/OpenSLX/DBSchema.pm
index 6d5400ad..0a141137 100644
--- a/config-db/OpenSLX/DBSchema.pm
+++ b/config-db/OpenSLX/DBSchema.pm
@@ -59,50 +59,47 @@ $DbSchema = {
'schema_version:s.5', # schema-version currently implemented by DB
],
'vendor_os' => [
- # a vendor os describes a folder containing an operating system as
+ # a vendor-OS describes a folder containing an operating system as
# provided by the vendor (a.k.a. unchanged and thus updatable)
- 'id:pk', # primary key
- 'name:s.48', # structured name of OS installation
- # (e.g. suse-9.3-minimal, suse-9.3-kde,
- # debian-3.1-ppc)
- 'comment:s.1024', # internal comment (optional, for admins)
- 'path:s.256', # path to os filesystem root
+ 'id:pk', # primary key
+ 'name:s.48', # structured name of OS installation
+ # (e.g. suse-9.3-kde, debian-3.1-ppc,
+ # suse-10.2-cloned-from-kiwi).
+ # This is used as the folder name for the
+ # corresponding stage1, too.
+ 'comment:s.1024', # internal comment (optional, for admins)
+ 'clone_source:s.256', # if vendor-OS was cloned, this contains
+ # the rsync-URI pointing to the original
],
- 'system' => [
- # a system describes one bootable instance of a vendor os
+ 'export' => [
+ # an export describes a vendor-OS "wrapped" in some kind of exporting
+ # format (NFS or NBD-squash). This represents the rootfs that the
+ # clients will see.
'id:pk', # primary key
+ 'name:s.64', # unique name of export, is automatically
+ # constructed like this:
+ # <vendor-os-name>-<export-type>
'vendor_os_id:fk', # foreign key
- 'name:s.48', # name used in filesystem and passed to
- # kernel via cmdline arg (e.g.:
- # suse-9.3-minimal, suse-9.3-minimal-nbd...)
- 'label:s.128', # name visible to user (pxe-label)
'comment:s.1024', # internal comment (optional, for admins)
- 'export_type:s.10', # 'nbd', 'nbd-squash', 'nfs', ...
- 'export_uri:s.256', # path to export (NDB-image or NFS-path), if
+ 'export_type:s.10', # 'nbd-squash', 'nfs', ...
+ 'export_uri:s.256', # path to export (squashfs or NFS-path), if
# empty it will be auto-generated by
# config-demuxer
- 'kernel:s.128', # path to kernel file, relative to OS root
- 'kernel_params:s.512', # kernel-param string for pxe
- 'ramfs_debug_level:i', # debug level for initramfs-generator-script
- 'ramfs_use_glibc:b', # use glibc in ramfs
- 'ramfs_use_busybox:b', # use busybox in ramfs
- 'ramfs_nicmods:s.128', # list of network interface card modules
- 'ramfs_fsmods:s.128', # list of filesystem modules
- 'ramfs_screen:s.10', # screen size for splash
- 'hidden:b', # hidden systems won't be offered for booting
- @sharedAttributes,
],
- 'system_variant' => [
- # a system_variant describes an alternative boot setup for a system
- # which will always be offered if the systems itself is offered by
- # a client
+ 'system' => [
+ # a system describes one bootable instance of an export, it
+ # represents a selectable line in the PXE boot menu of all the
+ # clients associated with this system
'id:pk', # primary key
- 'name_addition:s.48', # string added to system name in order to
- # get a unique system name
- 'system_id:fk', # foreign key
- 'label_addition:s.64', # visible name part (added to pxe-label)
+ 'export_id:fk', # foreign key
+ 'name:s.64', # unique name of system, is automatically
+ # constructed like this:
+ # <vendor-os-name>-<export-type>-<kernel>
+ 'label:s.64', # name visible to user (pxe-label)
+ # if empty, this will be autocreated from
+ # the name
'comment:s.1024', # internal comment (optional, for admins)
- 'kernel:s.128', # name of kernel file
+ 'kernel:s.128', # path to kernel file, relative to /boot
'kernel_params:s.512', # kernel-param string for pxe
'ramfs_debug_level:i', # debug level for initramfs-generator-script
'ramfs_use_glibc:b', # use glibc in ramfs
@@ -110,6 +107,8 @@ $DbSchema = {
'ramfs_nicmods:s.128', # list of network interface card modules
'ramfs_fsmods:s.128', # list of filesystem modules
'ramfs_screen:s.10', # screen size for splash
+ 'hidden:b', # hidden systems won't be offered for booting
+ @sharedAttributes,
],
'client' => [
# a client is a PC booting via network
@@ -211,6 +210,11 @@ $DbSchema = {
},
{
'cmd' => 'add-table',
+ 'table' => 'export',
+ 'cols' => $DbSchema->{'tables'}->{'export'},
+ },
+ {
+ 'cmd' => 'add-table',
'table' => 'system',
'cols' => $DbSchema->{'tables'}->{'system'},
'vals' => [
@@ -223,11 +227,6 @@ $DbSchema = {
},
{
'cmd' => 'add-table',
- 'table' => 'system_variant',
- 'cols' => $DbSchema->{'tables'}->{'system_variant'},
- },
- {
- 'cmd' => 'add-table',
'table' => 'client',
'cols' => $DbSchema->{'tables'}->{'client'},
'vals' => [
diff --git a/config-db/OpenSLX/MetaDB/Base.pm b/config-db/OpenSLX/MetaDB/Base.pm
index f42b5412..41d35d9f 100644
--- a/config-db/OpenSLX/MetaDB/Base.pm
+++ b/config-db/OpenSLX/MetaDB/Base.pm
@@ -21,11 +21,11 @@ sub new
confess "Don't create OpenSLX::MetaDB::Base - objects directly!";
}
-sub connectConfigDB
+sub connect
{
}
-sub disconnectConfigDB
+sub disconnect
{
}
@@ -36,51 +36,51 @@ sub quote
################################################################################
### data access interface
################################################################################
-sub fetchVendorOSesByFilter
+sub fetchVendorOSByFilter
{
}
-sub fetchVendorOSesByID
+sub fetchVendorOSByID
{
}
-sub fetchSystemsByFilter
+sub fetchExportByFilter
{
}
-sub fetchSystemsByID
+sub fetchExportByID
{
}
-sub fetchSystemIDsOfVendorOS
+sub fetchExportIDsOfVendorOS
{
}
-sub fetchSystemIDsOfClient
+sub fetchSystemByFilter
{
}
-sub fetchSystemIDsOfGroup
+sub fetchSystemByID
{
}
-sub fetchSystemVariantsByFilter
+sub fetchSystemIDsOfExport
{
}
-sub fetchSystemVariantsByID
+sub fetchSystemIDsOfClient
{
}
-sub fetchSystemVariantIDsOfSystem
+sub fetchSystemIDsOfGroup
{
}
-sub fetchClientsByFilter
+sub fetchClientByFilter
{
}
-sub fetchClientsByID
+sub fetchClientByID
{
}
@@ -92,11 +92,11 @@ sub fetchClientIDsOfGroup
{
}
-sub fetchGroupsByFilter
+sub fetchGroupByFilter
{
}
-sub fetchGroupsByID
+sub fetchGroupByID
{
}
@@ -136,27 +136,27 @@ sub changeVendorOS
{
}
-sub addSystem
+sub addExport
{
}
-sub removeSystem
+sub removeExport
{
}
-sub changeSystem
+sub changeExport
{
}
-sub addSystemVariant
+sub addSystem
{
}
-sub removeSystemVariant
+sub removeSystem
{
}
-sub changeSystemVariant
+sub changeSystem
{
}
@@ -425,7 +425,7 @@ allow the user to access data:
=over
-=item C<fetchVendorOSesByFilter([%$filter], [$resultCols])>
+=item C<fetchVendorOSByFilter([%$filter], [$resultCols])>
Fetches and returns information about all vendor-OSes that match the given
filter.
@@ -447,7 +447,7 @@ An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchVendorOSesByID(@$ids, [$resultCols])>
+=item C<fetchVendorOSByID(@$ids, [$resultCols])>
Fetches and returns information the vendor-OSes with the given IDs.
@@ -467,21 +467,21 @@ An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchSystemsByFilter([%$filter], [$resultCols])>
+=item C<fetchExportByFilter([%$filter], [$resultCols])>
-Fetches and returns information about all systems that match the given filter.
+Fetches and returns information about all exports that match the given
+filter.
=over
-=item Param C<$filter>
+=item Param C<filter>
A hash-ref containing the filter criteria that shall be applied - default
is no filtering. See L</"Filters"> for more info.
-=item Param C<$resultCols> [Optional]
+=item Param C<resultCols>
-A comma-separated list of colunm names that shall be returned. If not defined,
-all available data must be returned.
+A string listing the columns that shall be returned - default is all columns.
=item Return Value
@@ -489,15 +489,15 @@ An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchSystemsByID(@$ids, [$resultCols])>
+=item C<fetchExportByID(@$ids, [$resultCols])>
-Fetches and returns information the systems with the given IDs.
+Fetches and returns information the exports with the given IDs.
=over
=item Param C<ids>
-An array of the system-IDs you are interested in.
+An array of the export-IDs you are interested in.
=item Param C<resultCols>
@@ -509,15 +509,15 @@ An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchSystemIDsOfVendorOS($id)>
+=item C<fetchExportIDsOfVendorOS($id)>
-Fetches the IDs of all systems that make use of the vendor-OS with the given ID.
+Fetches the IDs of all exports that make use of the vendor-OS with the given ID.
=over
=item Param C<id>
-ID of the vendor-OS whose systems shall be returned.
+ID of the vendor-OS whose exports shall be returned.
=item Return Value
@@ -525,101 +525,99 @@ An array of system-IDs.
=back
-=item C<fetchSystemIDsOfClient($id)>
+=item C<fetchSystemByFilter([%$filter], [$resultCols])>
-Fetches the IDs of all systems that are used by the client with the given
-ID.
+Fetches and returns information about all systems that match the given filter.
=over
-=item Param C<id>
+=item Param C<$filter>
-ID of the client whose systems shall be returned.
+A hash-ref containing the filter criteria that shall be applied - default
+is no filtering. See L</"Filters"> for more info.
+
+=item Param C<$resultCols> [Optional]
+
+A comma-separated list of colunm names that shall be returned. If not defined,
+all available data must be returned.
=item Return Value
-An array of system-IDs.
+An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchSystemIDsOfGroup($id)>
+=item C<fetchSystemByID(@$ids, [$resultCols])>
-Fetches the IDs of all systems that are part of the group with the given
-ID.
+Fetches and returns information the systems with the given IDs.
=over
-=item Param C<id>
+=item Param C<ids>
-ID of the group whose systems shall be returned.
+An array of the system-IDs you are interested in.
+
+=item Param C<resultCols>
+
+A string listing the columns that shall be returned - default is all columns.
=item Return Value
-An array of system-IDs.
+An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchSystemVariantsByFilter([%$filter], [$resultCols])>
+=item C<fetchSystemIDsOfExport($id)>
-Fetches and returns information about all system variants that match the given
-filter.
+Fetches the IDs of all systems that make use of the export with the given ID.
=over
-=item Param C<$filter>
-
-A hash-ref containing the filter criteria that shall be applied - default
-is no filtering. See L</"Filters"> for more info.
-
-=item Param C<$resultCols> [Optional]
+=item Param C<id>
-A comma-separated list of colunm names that shall be returned. If not defined,
-all available data must be returned.
+ID of the export whose systems shall be returned.
=item Return Value
-An array of hash-refs containing the resulting data rows.
+An array of system-IDs.
=back
-=item C<fetchSystemVariantsByID(@$ids, [$resultCols])>
+=item C<fetchSystemIDsOfClient($id)>
-Fetches and returns information the systems variants with the given IDs.
+Fetches the IDs of all systems that are used by the client with the given
+ID.
=over
-=item Param C<ids>
-
-An array of the system-variant-IDs you are interested in.
-
-=item Param C<resultCols>
+=item Param C<id>
-A string listing the columns that shall be returned - default is all columns.
+ID of the client whose systems shall be returned.
=item Return Value
-An array of hash-refs containing the resulting data rows.
+An array of system-IDs.
=back
-=item C<fetchSystemVariantIDsOfSystem($id)>
+=item C<fetchSystemIDsOfGroup($id)>
-Fetches the IDs of all system variants that belong to the system with the given
+Fetches the IDs of all systems that are part of the group with the given
ID.
=over
=item Param C<id>
-ID of the system whose variants shall be returned.
+ID of the group whose systems shall be returned.
=item Return Value
-An array of system-variant-IDs.
+An array of system-IDs.
=back
-=item C<fetchClientsByFilter([%$filter], [$resultCols])>
+=item C<fetchClientByFilter([%$filter], [$resultCols])>
Fetches and returns information about all clients that match the given filter.
@@ -641,7 +639,7 @@ An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchClientsByID(@$ids, [$resultCols])>
+=item C<fetchClientByID(@$ids, [$resultCols])>
Fetches and returns information the clients with the given IDs.
@@ -697,7 +695,7 @@ An array of client-IDs.
-=item C<fetchGroupsByFilter([%$filter], [$resultCols])>
+=item C<fetchGroupByFilter([%$filter], [$resultCols])>
Fetches and returns information about all groups that match the given filter.
@@ -721,7 +719,7 @@ An array of hash-refs containing the resulting data rows.
-=item C<fetchGroupsByID(@$ids, [$resultCols])>
+=item C<fetchGroupByID(@$ids, [$resultCols])>
Fetches and returns information the groups with the given IDs.
@@ -861,163 +859,163 @@ C<1> if the vendorOS(es) could be changed, C<undef> if not.
-=item C<addSystem(@$valRows)>
+=item C<addExport(@$valRows)>
-Adds one or more systems to the database.
+Adds one or more export to the database.
=over
=item Param C<valRows>
-An array-ref containing hash-refs with the data of the new system(s).
+An array-ref containing hash-refs with the data of the new export(s).
=item Return Value
-The IDs of the new system(s), C<undef> if the creation failed.
+The IDs of the new export(s), C<undef> if the creation failed.
=back
-=item C<removeSystem(@$systemIDs)>
+=item C<removeExport(@$exportIDs)>
-Removes one or more systems from the database.
+Removes one or more export from the database.
=over
-=item Param C<systemIDs>
+=item Param C<exportIDs>
-An array-ref containing the IDs of the systems that shall be removed.
+An array-ref containing the IDs of the exports that shall be removed.
=item Return Value
-C<1> if the system(s) could be removed, C<undef> if not.
+C<1> if the export(s) could be removed, C<undef> if not.
=back
-=item C<changeSystem(@$systemIDs, @$valRows)>
+=item C<changeExport(@$exportIDs, @$valRows)>
-Changes the data of one or more systems.
+Changes the data of one or more export.
=over
-=item Param C<systemIDs>
+=item Param C<vendorOSIDs>
-An array-ref containing the IDs of the systems that shall be changed.
+An array-ref containing the IDs of the exports that shall be changed.
=item Param C<valRows>
-An array-ref containing hash-refs with the new data for the system(s).
+An array-ref containing hash-refs with the new data for the export(s).
=item Return Value
-C<1> if the system(s) could be changed, C<undef> if not.
+C<1> if the export(s) could be changed, C<undef> if not.
=back
-=item C<setClientIDsOfSystem($systemID, @$clientIDs)>
+=item C<addSystem(@$valRows)>
-Specifies all clients that should offer the given system for booting.
+Adds one or more systems to the database.
=over
-=item Param C<systemID>
-
-The ID of the system whose clients you'd like to specify.
-
-=item Param C<clientIDs>
+=item Param C<valRows>
-An array-ref containing the IDs of the clients that shall be connected to the
-system.
+An array-ref containing hash-refs with the data of the new system(s).
=item Return Value
-C<1> if the system/client references could be set, C<undef> if not.
+The IDs of the new system(s), C<undef> if the creation failed.
=back
-=item C<setGroupIDsOfSystem($systemID, @$groupIDs)>
+=item C<removeSystem(@$systemIDs)>
-Specifies all groups that should offer the given system for booting.
+Removes one or more systems from the database.
=over
-=item Param C<systemID>
-
-The ID of the system whose groups you'd like to specify.
-
-=item Param C<clientIDs>
+=item Param C<systemIDs>
-An array-ref containing the IDs of the groups that shall be connected to the
-system.
+An array-ref containing the IDs of the systems that shall be removed.
=item Return Value
-C<1> if the system/group references could be set, C<undef> if not.
+C<1> if the system(s) could be removed, C<undef> if not.
=back
-=item C<addSystemVariant(@$valRows)>
+=item C<changeSystem(@$systemIDs, @$valRows)>
-Adds one or more system-variants to the database.
+Changes the data of one or more systems.
=over
+=item Param C<systemIDs>
+
+An array-ref containing the IDs of the systems that shall be changed.
+
=item Param C<valRows>
-An array-ref containing hash-refs with the data of the new system-variant(s).
+An array-ref containing hash-refs with the new data for the system(s).
=item Return Value
-The IDs of the new system-variant(s), C<undef> if the creation failed.
+C<1> if the system(s) could be changed, C<undef> if not.
=back
-=item C<removeSystemVariant(@$systemVariantIDs)>
+=item C<setClientIDsOfSystem($systemID, @$clientIDs)>
-Removes one or more system-variants from the database.
+Specifies all clients that should offer the given system for booting.
=over
-=item Param C<systemIDs>
+=item Param C<systemID>
+
+The ID of the system whose clients you'd like to specify.
-An array-ref containing the IDs of the system-variants that shall be removed.
+=item Param C<clientIDs>
+
+An array-ref containing the IDs of the clients that shall be connected to the
+system.
=item Return Value
-C<1> if the system-variant(s) could be removed, C<undef> if not.
+C<1> if the system/client references could be set, C<undef> if not.
=back
-=item C<changeSystemVariant(@$systemVariantIDs, @$valRows)>
+=item C<setGroupIDsOfSystem($systemID, @$groupIDs)>
-Changes the data of one or more system-variants.
+Specifies all groups that should offer the given system for booting.
=over
-=item Param C<systemVariantIDs>
+=item Param C<systemID>
-An array-ref containing the IDs of the system-variants that shall be changed.
+The ID of the system whose groups you'd like to specify.
-=item Param C<valRows>
+=item Param C<clientIDs>
-An array-ref containing hash-refs with the new data for the system-variant(s).
+An array-ref containing the IDs of the groups that shall be connected to the
+system.
=item Return Value
-C<1> if the system-variant(s) could be changed, C<undef> if not.
+C<1> if the system/group references could be set, C<undef> if not.
=back
@@ -1255,6 +1253,6 @@ C<1> if the settings could be changed, C<undef> if not.
The following methods need to be implemented in a MetaDB driver in order to
be able to automatically adjust to new database schema versions (by adding
-and/or removing tables and table-columns).
+and/or removing tables and table-columns).
=cut
diff --git a/config-db/OpenSLX/MetaDB/CSV.pm b/config-db/OpenSLX/MetaDB/CSV.pm
index bed7bbd9..55da0beb 100644
--- a/config-db/OpenSLX/MetaDB/CSV.pm
+++ b/config-db/OpenSLX/MetaDB/CSV.pm
@@ -37,7 +37,7 @@ sub new
return bless $self, $class;
}
-sub connectConfigDB
+sub connect
{
my $self = shift;
diff --git a/config-db/OpenSLX/MetaDB/DBI.pm b/config-db/OpenSLX/MetaDB/DBI.pm
index ad4c12b5..4479ed84 100644
--- a/config-db/OpenSLX/MetaDB/DBI.pm
+++ b/config-db/OpenSLX/MetaDB/DBI.pm
@@ -30,7 +30,7 @@ sub new
confess "Don't call OpenSLX::MetaDB::DBI::new directly!";
}
-sub disconnectConfigDB
+sub disconnect
{
my $self = shift;
@@ -83,7 +83,7 @@ sub _doSelect
return @vals;
}
-sub fetchVendorOSesByFilter
+sub fetchVendorOSByFilter
{
my $self = shift;
my $filter = shift;
@@ -99,7 +99,7 @@ sub fetchVendorOSesByFilter
return $self->_doSelect($sql);
}
-sub fetchVendorOSesByID
+sub fetchVendorOSByID
{
my $self = shift;
my $ids = shift;
@@ -112,14 +112,14 @@ sub fetchVendorOSesByID
return $self->_doSelect($sql);
}
-sub fetchSystemsByFilter
+sub fetchExportByFilter
{
my $self = shift;
my $filter = shift;
my $resultCols = shift;
- $resultCols = '*' unless (defined $resultCols);
- my $sql = "SELECT $resultCols FROM system";
+ $resultCols = '*' unless (defined $resultCols);
+ my $sql = "SELECT $resultCols FROM export";
my $connector;
foreach my $col (keys %$filter) {
$connector = !defined $connector ? 'WHERE' : 'AND';
@@ -128,7 +128,7 @@ sub fetchSystemsByFilter
return $self->_doSelect($sql);
}
-sub fetchSystemsByID
+sub fetchExportByID
{
my $self = shift;
my $ids = shift;
@@ -137,51 +137,29 @@ sub fetchSystemsByID
$resultCols = '*' unless (defined $resultCols);
my $idStr = join ',', @$ids;
return if !length($idStr);
- my $sql = "SELECT $resultCols FROM system WHERE id IN ($idStr)";
+ my $sql = "SELECT $resultCols FROM export WHERE id IN ($idStr)";
return $self->_doSelect($sql);
}
-sub fetchSystemIDsOfVendorOS
+sub fetchExportIDsOfVendorOS
{
my $self = shift;
my $vendorOSID = shift;
my $sql = qq[
- SELECT id FROM system WHERE vendor_os_id = '$vendorOSID'
+ SELECT id FROM export WHERE vendor_os_id = '$vendorOSID'
];
return $self->_doSelect($sql, 'id');
}
-sub fetchSystemIDsOfClient
-{
- my $self = shift;
- my $clientID = shift;
-
- my $sql = qq[
- SELECT system_id FROM client_system_ref WHERE client_id = '$clientID'
- ];
- return $self->_doSelect($sql, 'system_id');
-}
-
-sub fetchSystemIDsOfGroup
-{
- my $self = shift;
- my $groupID = shift;
-
- my $sql = qq[
- SELECT system_id FROM group_system_ref WHERE group_id = '$groupID'
- ];
- return $self->_doSelect($sql, 'system_id');
-}
-
-sub fetchSystemVariantsByFilter
+sub fetchSystemByFilter
{
my $self = shift;
my $filter = shift;
my $resultCols = shift;
$resultCols = '*' unless (defined $resultCols);
- my $sql = "SELECT $resultCols FROM system_variant";
+ my $sql = "SELECT $resultCols FROM system";
my $connector;
foreach my $col (keys %$filter) {
$connector = !defined $connector ? 'WHERE' : 'AND';
@@ -190,7 +168,7 @@ sub fetchSystemVariantsByFilter
return $self->_doSelect($sql);
}
-sub fetchSystemVariantsByID
+sub fetchSystemByID
{
my $self = shift;
my $ids = shift;
@@ -199,22 +177,44 @@ sub fetchSystemVariantsByID
$resultCols = '*' unless (defined $resultCols);
my $idStr = join ',', @$ids;
return if !length($idStr);
- my $sql = "SELECT $resultCols FROM system_variant WHERE id IN ($idStr)";
+ my $sql = "SELECT $resultCols FROM system WHERE id IN ($idStr)";
return $self->_doSelect($sql);
}
-sub fetchSystemVariantIDsOfSystem
+sub fetchSystemIDsOfExport
{
my $self = shift;
- my $systemID = shift;
+ my $exportID = shift;
my $sql = qq[
- SELECT id FROM system_variant WHERE system_id = '$systemID'
+ SELECT id FROM system WHERE export_id = '$exportID'
];
return $self->_doSelect($sql, 'id');
}
-sub fetchClientsByFilter
+sub fetchSystemIDsOfClient
+{
+ my $self = shift;
+ my $clientID = shift;
+
+ my $sql = qq[
+ SELECT system_id FROM client_system_ref WHERE client_id = '$clientID'
+ ];
+ return $self->_doSelect($sql, 'system_id');
+}
+
+sub fetchSystemIDsOfGroup
+{
+ my $self = shift;
+ my $groupID = shift;
+
+ my $sql = qq[
+ SELECT system_id FROM group_system_ref WHERE group_id = '$groupID'
+ ];
+ return $self->_doSelect($sql, 'system_id');
+}
+
+sub fetchClientByFilter
{
my $self = shift;
my $filter = shift;
@@ -230,7 +230,7 @@ sub fetchClientsByFilter
return $self->_doSelect($sql);
}
-sub fetchClientsByID
+sub fetchClientByID
{
my $self = shift;
my $ids = shift;
@@ -265,7 +265,7 @@ sub fetchClientIDsOfGroup
return $self->_doSelect($sql, 'client_id');
}
-sub fetchGroupsByFilter
+sub fetchGroupByFilter
{
my $self = shift;
my $filter = shift;
@@ -281,7 +281,7 @@ sub fetchGroupsByFilter
return $self->_doSelect($sql);
}
-sub fetchGroupsByID
+sub fetchGroupByID
{
my $self = shift;
my $ids = shift;
@@ -526,6 +526,31 @@ sub changeVendorOS
return $self->_doUpdate('vendor_os', $vendorOSIDs, $valRows);
}
+sub addExport
+{
+ my $self = shift;
+ my $valRows = shift;
+
+ return $self->_doInsert('export', $valRows);
+}
+
+sub removeExport
+{
+ my $self = shift;
+ my $exportIDs = shift;
+
+ return $self->_doDelete('export', $exportIDs);
+}
+
+sub changeExport
+{
+ my $self = shift;
+ my $exportIDs = shift;
+ my $valRows = shift;
+
+ return $self->_doUpdate('export', $exportIDs, $valRows);
+}
+
sub addSystem
{
my $self = shift;
@@ -573,31 +598,6 @@ sub setGroupIDsOfSystem
'system_id', 'group_id', \@currGroups);
}
-sub addSystemVariant
-{
- my $self = shift;
- my $valRows = shift;
-
- return $self->_doInsert('system_variant', $valRows);
-}
-
-sub removeSystemVariant
-{
- my $self = shift;
- my $systemVariantIDs = shift;
-
- return $self->_doDelete('system_variant', $systemVariantIDs);
-}
-
-sub changeSystemVariant
-{
- my $self = shift;
- my $systemVariantIDs = shift;
- my $valRows = shift;
-
- return $self->_doUpdate('system_variant', $systemVariantIDs, $valRows);
-}
-
sub addClient
{
my $self = shift;
diff --git a/config-db/OpenSLX/MetaDB/SQLite.pm b/config-db/OpenSLX/MetaDB/SQLite.pm
index 059467d8..d7d0a2b6 100644
--- a/config-db/OpenSLX/MetaDB/SQLite.pm
+++ b/config-db/OpenSLX/MetaDB/SQLite.pm
@@ -35,7 +35,7 @@ sub new
return bless $self, $class;
}
-sub connectConfigDB
+sub connect
{
my $self = shift;
diff --git a/config-db/OpenSLX/MetaDB/mysql.pm b/config-db/OpenSLX/MetaDB/mysql.pm
index 3f42b966..1e0d01c3 100644
--- a/config-db/OpenSLX/MetaDB/mysql.pm
+++ b/config-db/OpenSLX/MetaDB/mysql.pm
@@ -35,7 +35,7 @@ sub new
return bless $self, $class;
}
-sub connectConfigDB
+sub connect
{
my $self = shift;
diff --git a/config-db/devel-tools/create-simple-db.pl b/config-db/devel-tools/create-simple-db.pl
index efb7d7ab..5fa91073 100755
--- a/config-db/devel-tools/create-simple-db.pl
+++ b/config-db/devel-tools/create-simple-db.pl
@@ -28,7 +28,7 @@ use lib "$FindBin::RealBin/..";
# development path to config-db stuff
use OpenSLX::Basics;
-use OpenSLX::ConfigDB qw(:access :manipulation);
+use OpenSLX::ConfigDB;
my (
$clobber,
@@ -53,12 +53,13 @@ if ($versionReq) {
openslxInit() or pod2usage(2);
-my $openslxDB = connectConfigDB();
+my $openslxDB = OpenSLX::ConfigDB->new;
+$openslxDB->connect();
-my @systems = fetchSystemsByFilter($openslxDB);
+my @systems = $openslxDB->fetchSystemByFilter();
my $systemCount = scalar(@systems)-1;
# ignore default system
-my @clients = fetchClientsByFilter($openslxDB);
+my @clients = $openslxDB->fetchClientByFilter();
my $clientCount = scalar(@clients)-1;
# ignore default client
if ($systemCount && $clientCount && !$clobber) {
@@ -75,70 +76,76 @@ Do you want to continue(%s/%s)? ], $systemCount, $clientCount, $yes, $no);
print "yes - starting...\n";
}
-emptyDatabase($openslxDB);
+$openslxDB->emptyDatabase();
-my $vendorOs1Id = addVendorOS($openslxDB, {
- 'name' => "suse-10",
- 'comment' => "SuSE 10.0 Default-Installation",
- 'path' => "suse-10.0",
+my $vendorOs1Id = $openslxDB->addVendorOS({
+ 'name' => "suse-10.0",
+ 'comment' => "SuSE 10.0 Default-Installation",
+});
+
+my $vendorOs2Id = $openslxDB->addVendorOS({
+ 'name' => "suse-10.1",
+ 'comment' => "SuSE 10.1 Default-Installation",
+});
+
+my $export1Id = $openslxDB->addExport({
+ 'vendor_os_id' => $vendorOs1Id,
+ 'export_type' => 'nfs',
});
-my $vendorOs2Id = addVendorOS($openslxDB, {
- 'name' => "suse-10.1",
- 'comment' => "SuSE 10.1 Default-Installation",
- 'path' => "suse-10.1",
+my $export2Id = $openslxDB->addExport({
+ 'vendor_os_id' => $vendorOs2Id,
+ 'export_type' => 'nfs',
});
my @systems;
-my $system1Id = addSystem($openslxDB, {
- 'name' => "suse-10.0",
+my $system1Id = $openslxDB->addSystem({
+ 'name' => "suse-10.0-nfs-vmlinuz",
'label' => "SUSE LINUX 10.0",
'comment' => "Testsystem für openslx",
- 'vendor_os_id' => $vendorOs1Id,
+ 'export_id' => $export1Id,
'ramfs_debug_level' => 0,
'ramfs_use_glibc' => 0,
'ramfs_use_busybox' => 0,
'ramfs_nicmods' => '',
'ramfs_fsmods' => '',
- 'kernel' => "boot/vmlinuz",
- 'kernel_params' => "",
- 'export_type' => 'nfs',
+ 'kernel' => "vmlinuz",
+ 'kernel_params' => "debug=8",
'attr_start_xdmcp' => 'kdm',
});
-my $system2Id = addSystem($openslxDB, {
- 'name' => "suse-10.1",
+my $system2Id = $openslxDB->addSystem({
+ 'name' => "suse-10.1-nfs-vmlinuz",
'label' => "SUSE LINUX 10.1",
'comment' => "Testsystem für openslx",
- 'vendor_os_id' => $vendorOs2Id,
+ 'export_id' => $export2Id,
'ramfs_debug_level' => 0,
'ramfs_use_glibc' => 0,
'ramfs_use_busybox' => 0,
'ramfs_nicmods' => '',
'ramfs_fsmods' => '',
- 'kernel' => "boot/vmlinuz",
- 'kernel_params' => "debug=0",
- 'export_type' => 'nfs',
+ 'kernel' => "vmlinuz",
+ 'kernel_params' => "debug=8",
'attr_start_xdmcp' => 'kdm',
});
-my $client1Id = addClient($openslxDB, {
+my $client1Id = $openslxDB->addClient({
'name' => "Client-1",
'mac' => "00:50:56:0D:03:38",
'boot_type' => 'pxe',
});
-my $client2Id = addClient($openslxDB, {
+my $client2Id = $openslxDB->addClient({
'name' => "Client-2",
'mac' => "00:16:41:55:12:92",
'boot_type' => 'pxe',
});
-addSystemIDsToClient($openslxDB, $client1Id, [$system1Id, $system2Id]);
-addSystemIDsToClient($openslxDB, $client2Id, [$system2Id]);
+$openslxDB->addSystemIDsToClient($client1Id, [$system1Id, $system2Id]);
+$openslxDB->addSystemIDsToClient($client2Id, [$system2Id]);
-disconnectConfigDB($openslxDB);
+$openslxDB->disconnect();
if ($openslxConfig{'db-type'} =~ m[^\s*csv\s*$]i) {
my $csvFolder = "$openslxConfig{'db-basepath'}/$openslxConfig{'db-name'}-csv";
diff --git a/config-db/devel-tools/test-config-db.pl b/config-db/devel-tools/test-config-db.pl
index 0d196130..c0d73d53 100755
--- a/config-db/devel-tools/test-config-db.pl
+++ b/config-db/devel-tools/test-config-db.pl
@@ -15,8 +15,11 @@ use lib "$FindBin::RealBin/../../lib";
use lib "$FindBin::RealBin/..";
# development path to config-db stuff
+print "THIS IS CURRENTLY BROKEN!!!\n";
+exit 5;
+
use OpenSLX::Basics;
-use OpenSLX::ConfigDB qw(:access :manipulation);
+use OpenSLX::ConfigDB;
openslxInit();
diff --git a/config-db/devel-tools/test-config-demuxer.pl b/config-db/devel-tools/test-config-demuxer.pl
index 43447dd9..8c1da03c 100755
--- a/config-db/devel-tools/test-config-demuxer.pl
+++ b/config-db/devel-tools/test-config-demuxer.pl
@@ -15,6 +15,9 @@ use lib "$FindBin::RealBin/../../lib";
use lib "$FindBin::RealBin/..";
# development path to config-db stuff
+print "THIS IS CURRENTLY BROKEN!!!\n";
+exit 5;
+
use OpenSLX::Basics;
use OpenSLX::ConfigDB qw(:access :manipulation);
diff --git a/config-db/slxconfig b/config-db/slxconfig
index fc1f7bcc..6e2b7c72 100755
--- a/config-db/slxconfig
+++ b/config-db/slxconfig
@@ -28,9 +28,8 @@ use lib "$FindBin::RealBin/../config-db";
# development path to config-db
use OpenSLX::Basics;
-use OpenSLX::ConfigDB qw(:access :manipulation);
+use OpenSLX::ConfigDB;
use OpenSLX::DBSchema;
-# use OpenSLX::OSSetup::Engine;
my (
$helpReq,
@@ -54,7 +53,8 @@ if ($versionReq) {
openslxInit();
-my $openslxDB = connectConfigDB();
+my $openslxDB = OpenSLX::ConfigDB->new();
+$openslxDB->connect();
my $action = shift @ARGV;
if ($action =~ m[^add-system$]i) {
@@ -66,7 +66,7 @@ if ($action =~ m[^add-system$]i) {
pod2usage(2);
}
-disconnectConfigDB($openslxDB);
+$openslxDB->disconnect();
exit;
@@ -96,20 +96,20 @@ sub addSystemToConfigDB
my @systemKeys
= map { (/^(\w+)\W/) ? $1 : $_; }
@{$DbSchema->{tables}->{system}};
- push @systemKeys, 'clients', 'vendor_os';
+ push @systemKeys, 'clients', 'export';
my $systemData = parseKeyValueArgs(\@systemKeys, 'system', @_);
- if (!length($systemData->{vendor_os})) {
- die _tr("you have to specify the vendor_os the new system shall be based on\n");
+ if (!length($systemData->{export})) {
+ die _tr("you have to specify the export the new system shall be using\n");
}
- my $vendorOSName = $systemData->{vendor_os};
- delete $systemData->{vendor_os};
- my $vendorOS
- = fetchVendorOSesByFilter($openslxDB, { 'name' => $vendorOSName });
- if (!defined $vendorOS) {
- die _tr("vendor-OS '%s' could not be found!\n", $vendorOSName);
+ my $exportName = $systemData->{export};
+ delete $systemData->{export};
+ my $export
+ = $openslxDB->fetchExportByFilter({ 'name' => $exportName });
+ if (!defined $export) {
+ die _tr("export '%s' could not be found in DB, giving up!\n", $exportName);
}
- $systemData->{vendor_os_id} = $vendorOS->{id};
+ $systemData->{export_id} = $export->{id};
my @clientIDs;
my $clientNames;
@@ -117,10 +117,9 @@ sub addSystemToConfigDB
@clientIDs
= map {
my $client
- = fetchClientsByFilter($openslxDB,
- { 'name' => $_ });
+ = $openslxDB->fetchClientByFilter({ 'name' => $_ });
if (!defined $client) {
- die _tr("client '%s' doesn't exist!\n", $_);
+ die _tr("client '%s' doesn't exist in DB, giving up!\n", $_);
}
$client->{id};
}
@@ -129,17 +128,14 @@ sub addSystemToConfigDB
delete $systemData->{clients};
}
- if (!length($systemData->{export_type})) {
- die _tr("you have to specify the export_type for this system ('nfs', 'nbd' or 'nbd-squash')\n");
+ if (!length($systemData->{kernel})) {
+ $systemData->{kernel} = 'vmlinuz';
}
if (!length($systemData->{name})) {
- $systemData->{name} = $vendorOSName;
+ $systemData->{name} = "$exportName-$systemData->{kernel}";
}
if (!length($systemData->{label})) {
- $systemData->{label} = $vendorOSName;
- }
- if (!length($systemData->{kernel})) {
- $systemData->{kernel} = '/boot/vmlinuz';
+ $systemData->{label} = "$exportName-$systemData->{kernel}";
}
if (!length($systemData->{ramfs_debug_level})) {
$systemData->{ramfs_debug_level} = '0';
@@ -150,12 +146,19 @@ sub addSystemToConfigDB
if (!length($systemData->{ramfs_use_busybox})) {
$systemData->{ramfs_use_busybox} = '1';
}
- my $systemID = addSystem($openslxDB, [$systemData]);
+
+ if ($openslxDB->fetchSystemByFilter({ 'name' => $systemData->{name} })) {
+ die _tr("the system '%s' already exists in the DB, giving up!\n",
+ $systemData->{name});
+ }
+ my $systemID = $openslxDB->addSystem([$systemData]);
+ vlog 0, _tr("system '%s' has been successfully added to DB (ID=%s)\n",
+ $systemData->{name}, $systemID);
if (scalar(@clientIDs)) {
- addClientIDsToSystem($openslxDB, $systemID, \@clientIDs);
+ $openslxDB->addClientIDsToSystem($systemID, \@clientIDs);
if ($verbose) {
- print _tr("clients of this system are:\n\t%s\n", $clientNames);
+ vlog 0, _tr("clients of this system are:\n\t%s\n", $clientNames);
}
}
}
@@ -174,8 +177,7 @@ sub addClientToConfigDB
@systemIDs
= map {
my $system
- = fetchSystemsByFilter($openslxDB,
- { 'name' => $_ });
+ = $openslxDB->fetchSystemByFilter({ 'name' => $_ });
if (!defined $system) {
die _tr("system '%s' doesn't exist!\n", $_);
}
@@ -196,10 +198,16 @@ sub addClientToConfigDB
$clientData->{boot_type} = 'pxe';
}
- my $clientID = addClient($openslxDB, [$clientData]);
+ if ($openslxDB->fetchClientByFilter({ 'name' => $clientData->{name} })) {
+ die _tr("the client '%s' already exists in the DB, giving up!\n",
+ $clientData->{name});
+ }
+ my $clientID = $openslxDB->addClient([$clientData]);
+ vlog 0, _tr("client '%s' has been successfully added to DB (ID=%s)\n",
+ $clientData->{name}, $clientID);
if (scalar(@systemIDs)) {
- addSystemIDsToClient($openslxDB, $clientID, \@systemIDs);
+ $openslxDB->addSystemIDsToClient($clientID, \@systemIDs);
if ($verbose) {
print _tr("systems for this client are:\n\t%s\n", $systemNames);
}
@@ -218,14 +226,22 @@ and you can create clients for that system, too.
=head2 Adding a new System to a Vendor-OS Export
- slxconfig add-system <export-name> [<attribute=value> ...]
+ slxconfig add-system export-name=<export-name> [clients=<client-Names>] [<attribute=value> ...]
The above syntax is used to add a new system to the config-DB. The new
- system will use the given I<export> (an exported vendor-OS).
+ system will use the I<export> whose name is given.
+
+ If you specify clients (a comma-separated list of client names), the new system
+ will be used by the given clients.
=head2 Adding a new Client
- slxos-setup clone <vendor-os-name> --source=<rsync-source>
+ slxconfig add-client [systems=<system-IDs> [<attribute=value> ...]
+
+ The above syntax is used to add a new client to the config-DB.
+
+ If you specify systems (a comma-separated list of system names), the new client
+ will use the given systems.
=head2 General Format
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);
diff --git a/installer/OpenSLX/OSExport/Engine.pm b/installer/OpenSLX/OSExport/Engine.pm
index 033b22be..555baee2 100644
--- a/installer/OpenSLX/OSExport/Engine.pm
+++ b/installer/OpenSLX/OSExport/Engine.pm
@@ -82,7 +82,7 @@ sub initialize
{
my $self = shift;
my $vendorOSName = shift;
- my $exportType = shift;
+ my $exportType = lc(shift);
if (!exists $supportedExportTypes{lc($exportType)}) {
print _tr("Sorry, export type '%s' is unsupported.\n", $exportType);
@@ -92,6 +92,7 @@ sub initialize
}
$self->{'vendor-os-name'} = $vendorOSName;
+ $self->{'export-name'} = "$vendorOSName-$exportType";
$vendorOSName =~ m[^(.+?\-[^-]+)];
my $distroName = $1;
$self->{'distro-name'} = $distroName;
@@ -112,7 +113,6 @@ sub initialize
die _tr('Could not load module <%s> (Version <%s> required, but <%s> found)',
$distroModule, 1.01, $modVersion);
}
- $distroModule->import;
my $distro = $distroModule->new;
$distro->initialize($self);
$self->{distro} = $distro;
@@ -133,7 +133,6 @@ sub initialize
die _tr('Could not load module <%s> (Version <%s> required, but <%s> found)',
$exportTypeModule, 1.01, $modVersion);
}
- $exportTypeModule->import;
my $exporter = $exportTypeModule->new;
$exporter->initialize($self);
$self->{'exporter'} = $exporter;
@@ -165,9 +164,6 @@ sub addExportToConfigDB
{
my $self = shift;
-print "adding the export to the config-DB is not implemented yet, sorry!\n";
-return;
-
my $configDBModule = "OpenSLX::ConfigDB";
unless (eval "require $configDBModule") {
if ($! == 2) {
@@ -181,36 +177,36 @@ return;
die _tr('Could not load module <%s> (Version <%s> required, but <%s> found)',
$configDBModule, 1.01, $modVersion);
}
- $configDBModule->import(qw(:access :manipulation));
- my $openslxDB = connectConfigDB();
- # insert new export if it doesn't already exist in DB:
- my $exportName = $self->{'vendor-os-name'};
+ my $openslxDB = $configDBModule->new();
+ $openslxDB->connect();
- my $export = fetchExportsByFilter(
- $openslxDB, { 'name' => $exportName }, 'id'
- );
+ # insert new export if it doesn't already exist in DB:
+ my $exportName = $self->{'export-name'};
+ my $export
+ = $openslxDB->fetchExportByFilter({'name' => $exportName});
if (defined $export) {
- changeExport(
- $openslxDB,
- {
- 'name' => $exportName,
- 'path' => $self->{'vendor-os-name'},
- }
- );
- vlog 0, _tr("Export <%s> has been updated in DB.\n", $exportName);
+ vlog 0, _tr("No need to change export '%s' in OpenSLX-database.\n",
+ $exportName);
} else {
- my $id = addExport(
- $openslxDB,
+ my $vendorOSName = $self->{'vendor-os-name'};
+ my $vendorOS
+ = $openslxDB->fetchVendorOSByFilter({'name' => $vendorOSName});
+ if (!defined $vendorOS) {
+ die _tr("vendor-OS '%s' could not be found in OpenSLX-database, giving up!\n",
+ $vendorOSName);
+ }
+ my $id = $openslxDB->addExport(
{
+ 'vendor_os_id' => $vendorOS->{id},
'name' => $exportName,
- 'path' => $self->{'vendor-os-name'},
+ 'export_type' => $self->{'export-type'},
}
);
vlog 0, _tr("Export <%s> has been added to DB (ID=%s).\n",
$exportName, $id);
}
- disconnectConfigDB($openslxDB);
+ $openslxDB->disconnect();
}
}
diff --git a/installer/OpenSLX/OSExport/ExportType/NFS.pm b/installer/OpenSLX/OSExport/ExportType/NFS.pm
index ccaa32c5..ac85b9c8 100644
--- a/installer/OpenSLX/OSExport/ExportType/NFS.pm
+++ b/installer/OpenSLX/OSExport/ExportType/NFS.pm
@@ -63,7 +63,7 @@ sub exportViaRsync
$target, $!);
}
my $includeExcludeList = $self->determineIncludeExcludeList();
- vlog 1, "using include-exclude-filter:\n$includeExcludeList\n";
+ vlog 1, _tr("using include-exclude-filter:\n%s\n", $includeExcludeList);
open(RSYNC, "| rsync -av --delete --exclude-from=- $source/ $target")
or die _tr("unable to start rsync for source '%s', giving up! (%s)",
$source, $!);
@@ -97,7 +97,7 @@ sub addTargetToNfsExports
print (('#' x 80)."\n");
print _tr("Please make sure the following line is contained in /etc/exports\nin order to activate the NFS-export of this vendor-OS:\n\t%s\n",
- "$self->{engine}->{'export-path'}\t*(ro,root_squash,sync,no_subtree_check)");
+ "$self->{engine}->{'export-path'}\t*(ro,root_squash,async,no_subtree_check)");
print (('#' x 80)."\n");
# TODO : add something a bit more clever here...
diff --git a/installer/OpenSLX/OSSetup/Engine.pm b/installer/OpenSLX/OSSetup/Engine.pm
index b07334de..beef84a7 100644
--- a/installer/OpenSLX/OSSetup/Engine.pm
+++ b/installer/OpenSLX/OSSetup/Engine.pm
@@ -117,7 +117,6 @@ sub initialize
die _tr("Could not load module <%s> (Version <%s> required, but <%s> found)\n",
$distroModule, 1.01, $modVersion);
}
- $distroModule->import;
my $distro = $distroModule->new;
$distro->initialize($self);
$self->{distro} = $distro;
@@ -173,6 +172,9 @@ sub installVendorOS
}
$self->stage1C_cleanupBasicVendorOS();
$self->setupStage1D();
+ my $installInfoFile = "$self->{'vendor-os-path'}/.openslx-install-info";
+ system("touch $installInfoFile");
+ # just touch the file, in order to indicate a proper installation
vlog 0, _tr("Vendor-OS <%s> installed succesfully.\n",
$self->{'vendor-os-name'});
@@ -184,14 +186,18 @@ sub cloneVendorOS
my $self = shift;
my $source = shift;
+ $self->{'clone-source'} = $source;
my $lastCloneSource;
my $cloneInfoFile = "$self->{'vendor-os-path'}/.openslx-clone-info";
+ my $isReClone;
if (-e $self->{'vendor-os-path'}) {
- if (!-e $cloneInfoFile) {
- # oops, given vendor-os has not been cloned originally, we complain:
+ my $installInfoFile = "$self->{'vendor-os-path'}/.openslx-install-info";
+ if (-e $installInfoFile) {
+ # oops, given vendor-os has been installed, not cloned, we complain:
die _tr("The vendor-OS '%s' exists but it is no clone, refusing to clobber!\nPlease delete the folder manually, if that's really what you want...\n",
$self->{'vendor-os-path'});
- } else {
+ } elsif (-e $cloneInfoFile) {
+ # check if last and current source match:
my $cloneInfo = slurpFile($cloneInfoFile);
if ($cloneInfo =~ m[^source\s*=\s*(.+?)\s*$]ims) {
$lastCloneSource = $1;
@@ -200,11 +206,17 @@ sub cloneVendorOS
# protect user from confusing sources (still allowed, though):
my $yes = _tr('yes');
my $no = _tr('no');
- print _tr("Last time this vendor-OS was cloned, it has been cloned from '%s', now you specified a different source: '%s'\nWould you still like to proceed(%s/%s)? ",
+ print _tr("Last time this vendor-OS was cloned, it has been cloned from '%s', now you specified a different source: '%s'\nWould you still like to proceed (%s/%s)? ",
$lastCloneSource, $source, $yes, $no);
my $answer = <STDIN>;
exit 5 unless $answer =~ m[^\s*$yes]i;
}
+ $isReClone = 1;
+ } else {
+ # Neither the install-info nor the clone-info file exists. This
+ # probably means that the folder has been created by an older
+ # version of the tools. There's not much we can do, we simply
+ # trust our user and assume that he knows what he's doing.
}
}
@@ -218,8 +230,13 @@ sub cloneVendorOS
print CLONE_INFO "source=$source";
close CLONE_INFO;
}
- vlog 0, _tr("Vendor-OS <%s> cloned succesfully.\n",
- $self->{'vendor-os-name'});
+ if ($isReClone) {
+ vlog 0, _tr("Vendor-OS <%s> has been re-cloned succesfully.\n",
+ $self->{'vendor-os-name'});
+ } else {
+ vlog 0, _tr("Vendor-OS <%s> has been cloned succesfully.\n",
+ $self->{'vendor-os-name'});
+ }
$self->addInstalledVendorOSToConfigDB();
}
@@ -258,28 +275,37 @@ sub addInstalledVendorOSToConfigDB
die _tr("Could not load module <%s> (Version <%s> required, but <%s> found)\n",
$configDBModule, 1.01, $modVersion);
}
- $configDBModule->import(qw(:access :manipulation));
- my $openslxDB = connectConfigDB();
+ my $openslxDB = $configDBModule->new();
+ $openslxDB->connect();
# insert new vendor-os if it doesn't already exist in DB:
my $vendorOSName = $self->{'vendor-os-name'};
my $vendorOS
- = fetchVendorOSesByFilter($openslxDB,
- { 'name' => $vendorOSName },
- 'id');
+ = $openslxDB->fetchVendorOSByFilter({ 'name' => $vendorOSName });
if (defined $vendorOS) {
- vlog 0, _tr("Vendor-OS <%s> already exists in OpenSLX-database.\n",
- $vendorOSName);
+ if ($self->{'clone-source'} ne $vendorOS->{'clone_source'}) {
+ $openslxDB->changeVendorOS($vendorOS->{id}, {
+ 'clone_source' => $self->{'clone-source'},
+ });
+ vlog 0, _tr("Vendor-OS '%s' has been updated in OpenSLX-database.\n",
+ $vendorOSName);
+ } else {
+ vlog 0, _tr("No need to change vendor-OS '%s' in OpenSLX-database.\n",
+ $vendorOSName);
+ }
} else {
- my $id = addVendorOS($openslxDB, {
+ my $data = {
'name' => $vendorOSName,
- 'path' => $self->{'vendor-os-name'},
- });
+ };
+ if (length($self->{'clone-source'})) {
+ $data->{'clone_source'} = $self->{'clone-source'};
+ }
+ my $id = $openslxDB->addVendorOS($data);
- vlog 0, _tr("Vendor-OS <%s> has been added to DB (ID=%s).\n",
+ vlog 0, _tr("Vendor-OS '%s' has been added to DB (ID=%s).\n",
$vendorOSName, $id);
}
- disconnectConfigDB($openslxDB);
+ $openslxDB->disconnect();
}
}
@@ -363,7 +389,6 @@ sub createPackager
die _tr("Could not load module <%s> (Version <%s> required, but <%s> found)\n",
$packagerModule, 1.01, $modVersion);
}
- $packagerModule->import;
my $packager = $packagerModule->new;
$packager->initialize($self);
$self->{'packager'} = $packager;
@@ -387,7 +412,6 @@ sub createMetaPackager
die _tr("Could not load module <%s> (Version <%s> required, but <%s> found)\n",
$metaPackagerModule, 1.01, $modVersion);
}
- $metaPackagerModule->import;
my $metaPackager = $metaPackagerModule->new;
$metaPackager->initialize($self);
$self->{'meta-packager'} = $metaPackager;
@@ -728,7 +752,8 @@ sub clone_fetchSource
my $self = shift;
my $source = shift;
- vlog 0, _tr("Cloning vendor-OS from <%s>...\n", $source);
+ vlog 0, _tr("Cloning vendor-OS from '%s' to '%s'...\n", $source,
+ $self->{'vendor-os-path'});
my $excludeIncludeList = $self->clone_determineIncludeExcludeList();
vlog 1, "using exclude-include-filter:\n$excludeIncludeList\n";
open(RSYNC, "| rsync -av --delete --exclude-from=- $source $self->{'vendor-os-path'}")
diff --git a/installer/slxos-setup b/installer/slxos-setup
index bd279dcd..75d562c3 100755
--- a/installer/slxos-setup
+++ b/installer/slxos-setup
@@ -90,8 +90,8 @@ chdir($FindBin::RealBin)
my $engine = OpenSLX::OSSetup::Engine->new;
if ($action =~ m[import]i) {
$engine->initialize($vendorOSName, 0, 'import');
- if (!-e $engine->{'system-path'}) {
- die _tr("'%s' doesn't exist, giving up!\n", $engine->{'system-path'});
+ if (!-e $engine->{'vendor-os-path'}) {
+ die _tr("'%s' doesn't exist, giving up!\n", $engine->{'vendor-os-path'});
}
$engine->addInstalledVendorOSToConfigDB();
} elsif ($action =~ m[update]i) {
diff --git a/lib/OpenSLX/Basics.pm b/lib/OpenSLX/Basics.pm
index 9c5b0b6c..b1e052a4 100644
--- a/lib/OpenSLX/Basics.pm
+++ b/lib/OpenSLX/Basics.pm
@@ -15,7 +15,7 @@ $VERSION = 1.01;
@EXPORT = qw(
&openslxInit %openslxConfig %cmdlineConfig
- &_tr &trInit
+ &_tr &trInit die
&vlog
);
@@ -29,6 +29,8 @@ use FindBin;
use Getopt::Long;
use POSIX qw(locale_h);
+my $DEBUG = 0;
+
my %translations;
# this hash will hold the active openslx configuration,
@@ -271,4 +273,19 @@ sub _tr
return sprintf($formatStr, @_);
}
+# ------------------------------------------------------------------------------
+sub die
+{
+ my $msg = shift;
+ if ($DEBUG) {
+ print STDERR "*** ";
+ croak $msg;
+ } else {
+ $msg =~ s[^][!!! ]igms;
+ chomp $msg;
+ print STDERR "$msg\n";
+ exit $!;
+ }
+}
+
1; \ No newline at end of file
diff --git a/lib/OpenSLX/Utils.pm b/lib/OpenSLX/Utils.pm
index a6048621..0980a7c0 100644
--- a/lib/OpenSLX/Utils.pm
+++ b/lib/OpenSLX/Utils.pm
@@ -22,6 +22,7 @@ $VERSION = 1.01;
################################################################################
use Carp;
use OpenSLX::Basics;
+use File::Basename;
sub copyFile
{