summaryrefslogtreecommitdiffstats
path: root/config-db
diff options
context:
space:
mode:
authorOliver Tappe2008-02-09 21:17:10 +0100
committerOliver Tappe2008-02-09 21:17:10 +0100
commit55eba91c566d566b07fccb782ca35e0a829619d5 (patch)
tree04e04c2a7bfbc644ea597415438e8899de18cafa /config-db
parent* cmdline options are now collected in a hash instead of individual variables, (diff)
downloadcore-55eba91c566d566b07fccb782ca35e0a829619d5.tar.gz
core-55eba91c566d566b07fccb782ca35e0a829619d5.tar.xz
core-55eba91c566d566b07fccb782ca35e0a829619d5.zip
* dropped attribute ramfs_screen as it is no longer needed (splashy does
not need to be given the screen-size) - updating schema version to 0.25 * little code simplification in DBSchema.pm * removed ramfs_screen from all tests * added method removeAttributeByName() to MetaDB in order to be able to remove attributes from the DB in a simple manner git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1528 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db')
-rw-r--r--config-db/OpenSLX/AttributeRoster.pm10
-rw-r--r--config-db/OpenSLX/DBSchema.pm36
-rw-r--r--config-db/OpenSLX/MetaDB/DBI.pm10
-rw-r--r--config-db/t/12-system.t2
-rw-r--r--config-db/t/25-attributes.t12
5 files changed, 24 insertions, 46 deletions
diff --git a/config-db/OpenSLX/AttributeRoster.pm b/config-db/OpenSLX/AttributeRoster.pm
index e196b5d3..b3366c01 100644
--- a/config-db/OpenSLX/AttributeRoster.pm
+++ b/config-db/OpenSLX/AttributeRoster.pm
@@ -166,16 +166,6 @@ sub _init
content_descr => undef,
default => 'forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32',
},
- 'ramfs_screen' => {
- applies_to_systems => 1,
- applies_to_clients => 0,
- description => unshiftHereDoc(<<' End-of-Here'),
- resolution of splash screen to use in stage3
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- default => '',
- },
'sane_scanner' => {
applies_to_systems => 1,
applies_to_clients => 1,
diff --git a/config-db/OpenSLX/DBSchema.pm b/config-db/OpenSLX/DBSchema.pm
index 3a0193dd..26d85465 100644
--- a/config-db/OpenSLX/DBSchema.pm
+++ b/config-db/OpenSLX/DBSchema.pm
@@ -35,7 +35,7 @@ use OpenSLX::Basics;
### fk => foreign key (integer)
################################################################################
-my $VERSION = 0.24;
+my $VERSION = 0.25;
my $DbSchema = {
'version' => $VERSION,
@@ -341,9 +341,13 @@ sub _schemaUpgradeDBFrom
my $metaDB = shift;
my $currVersion = shift;
- foreach my $version (sort { $a cmp $b } keys %DbSchemaHistory) {
+ foreach my $version (sort { $a <=> $b } keys %DbSchemaHistory) {
next if $currVersion >= $version;
- $DbSchemaHistory{$version}->($metaDB);
+
+ vlog(0, "upgrading schema version to $version");
+ if ($DbSchemaHistory{$version}->($metaDB)) {
+ $metaDB->schemaSetDBVersion($version);
+ }
}
return 1;
@@ -353,8 +357,6 @@ sub _schemaUpgradeDBFrom
0.2 => sub {
my $metaDB = shift;
- vlog(0, "upgrading schema version to 0.2");
-
# move attributes into separate tables ...
#
# ... system attributes ...
@@ -560,15 +562,11 @@ sub _schemaUpgradeDBFrom
]
);
- $metaDB->schemaSetDBVersion(0.2);
-
return 1;
},
0.21 => sub {
my $metaDB = shift;
- vlog(0, "upgrading schema version to 0.21");
-
# add new table installed_plugins
$metaDB->schemaAddTable(
'installed_plugin',
@@ -579,27 +577,19 @@ sub _schemaUpgradeDBFrom
]
);
- $metaDB->schemaSetDBVersion(0.21);
-
return 1;
},
0.22 => sub {
my $metaDB = shift;
- vlog(0, "upgrading schema version to 0.22");
-
# dummy schema change, just to trigger the attribute synchronization
# into the default system
- $metaDB->schemaSetDBVersion(0.22);
-
return 1;
},
0.23 => sub {
my $metaDB = shift;
- vlog(0, "upgrading schema version to 0.23");
-
# add new column system.descripion
$metaDB->schemaAddColumns(
'system',
@@ -620,15 +610,11 @@ sub _schemaUpgradeDBFrom
]
);
- $metaDB->schemaSetDBVersion(0.23);
-
return 1;
},
0.24 => sub {
my $metaDB = shift;
- vlog(0, "upgrading schema version to 0.24");
-
# split theme::name into theme::splash, theme::displaymanager and
# theme::desktop
foreach my $system ($metaDB->fetchSystemByFilter()) {
@@ -653,7 +639,13 @@ sub _schemaUpgradeDBFrom
}
}
- $metaDB->schemaSetDBVersion(0.24);
+ return 1;
+ },
+ 0.25 => sub {
+ my $metaDB = shift;
+
+ # drop attribute ramfs_screen
+ $metaDB->removeAttributeByName('ramfs_screen');
return 1;
},
diff --git a/config-db/OpenSLX/MetaDB/DBI.pm b/config-db/OpenSLX/MetaDB/DBI.pm
index 2d6b5a55..70bc504f 100644
--- a/config-db/OpenSLX/MetaDB/DBI.pm
+++ b/config-db/OpenSLX/MetaDB/DBI.pm
@@ -878,6 +878,16 @@ sub addClient
return @clientIDs;
}
+sub removeAttributeByName
+{
+ my $self = shift;
+ my $attrName = shift;
+
+ return $self->_doDelete('system_attr', [ $attrName ], 'name')
+ && $self->_doDelete('client_attr', [ $attrName ], 'name')
+ && $self->_doDelete('group_attr', [ $attrName ], 'name');
+}
+
sub removeClient
{
my $self = shift;
diff --git a/config-db/t/12-system.t b/config-db/t/12-system.t
index dc8670de..e16a72d5 100644
--- a/config-db/t/12-system.t
+++ b/config-db/t/12-system.t
@@ -78,7 +78,6 @@ my $fullSystem = {
'ramfs_fsmods' => 'l',
'ramfs_miscmods' => 'm',
'ramfs_nicmods' => 'n',
- 'ramfs_screen' => 'o',
'sane_scanner' => 'p',
'scratch' => 'q',
'slxgrp' => 'r',
@@ -134,7 +133,6 @@ is($system3->{attrs}->{nis_servers}, 'k', 'system 3 - attr ni
is($system3->{attrs}->{ramfs_fsmods}, 'l', 'system 3 - attr ramfs_fsmods');
is($system3->{attrs}->{ramfs_miscmods}, 'm', 'system 3 - attr ramfs_miscmods');
is($system3->{attrs}->{ramfs_nicmods}, 'n', 'system 3 - attr ramfs_nicmods');
-is($system3->{attrs}->{ramfs_screen}, 'o', 'system 3 - attr ramfs_screen');
is($system3->{attrs}->{sane_scanner}, 'p', 'system 3 - attr sane_scanner');
is($system3->{attrs}->{scratch}, 'q', 'system 3 - attr scratch');
is($system3->{attrs}->{slxgrp}, 'r', 'system 3 - attr slxgrp');
diff --git a/config-db/t/25-attributes.t b/config-db/t/25-attributes.t
index 0a83afa9..469d330c 100644
--- a/config-db/t/25-attributes.t
+++ b/config-db/t/25-attributes.t
@@ -17,7 +17,6 @@ my $defaultAttrs = { # mostly copied from DBSchema
'ramfs_fsmods' => undef,
'ramfs_miscmods' => undef,
'ramfs_nicmods' => 'forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32',
- 'ramfs_screen' => undef,
'automnt_dir' => undef,
'automnt_src' => undef,
@@ -74,7 +73,6 @@ my $sys3Attrs = {
'ramfs_fsmods' => '-4',
'ramfs_miscmods' => '-3',
'ramfs_nicmods' => '-2',
- 'ramfs_screen' => '-1',
'automnt_dir' => '1',
'automnt_src' => '2',
@@ -132,7 +130,6 @@ my $shouldBeAttrs1 = {
'ramfs_fsmods' => 'squashfs',
'ramfs_miscmods' => undef,
'ramfs_nicmods' => 'forcedeth e1000 r8169',
- 'ramfs_screen' => undef,
'automnt_dir' => undef,
'automnt_src' => undef,
@@ -183,7 +180,6 @@ my $shouldBeAttrs3 = {
'ramfs_fsmods' => '-4',
'ramfs_miscmods' => '-3',
'ramfs_nicmods' => '-2',
- 'ramfs_screen' => '-1',
'automnt_dir' => '1',
'automnt_src' => '2',
@@ -280,7 +276,6 @@ $shouldBeAttrs1 = {
'ramfs_fsmods' => undef,
'ramfs_miscmods' => undef,
'ramfs_nicmods' => undef,
- 'ramfs_screen' => undef,
'automnt_dir' => undef,
'automnt_src' => undef,
@@ -330,7 +325,6 @@ $shouldBeAttrs3 = {
'ramfs_fsmods' => undef,
'ramfs_miscmods' => undef,
'ramfs_nicmods' => undef,
- 'ramfs_screen' => undef,
'automnt_dir' => undef,
'automnt_src' => undef,
@@ -389,7 +383,6 @@ $shouldBeAttrs1 = {
'ramfs_fsmods' => undef,
'ramfs_miscmods' => undef,
'ramfs_nicmods' => undef,
- 'ramfs_screen' => undef,
'automnt_dir' => undef,
'automnt_src' => undef,
@@ -439,7 +432,6 @@ $shouldBeAttrs3 = {
'ramfs_fsmods' => undef,
'ramfs_miscmods' => undef,
'ramfs_nicmods' => undef,
- 'ramfs_screen' => undef,
'automnt_dir' => undef,
'automnt_src' => undef,
@@ -495,7 +487,6 @@ my $shouldBeAttrs11 = {
'ramfs_fsmods' => 'squashfs',
'ramfs_miscmods' => undef,
'ramfs_nicmods' => 'forcedeth e1000 r8169',
- 'ramfs_screen' => undef,
'automnt_dir' => undef,
'automnt_src' => undef,
@@ -545,7 +536,6 @@ my $shouldBeAttrs31 = {
'ramfs_fsmods' => 'squashfs',
'ramfs_miscmods' => undef,
'ramfs_nicmods' => 'forcedeth e1000 r8169',
- 'ramfs_screen' => undef,
'automnt_dir' => undef,
'automnt_src' => undef,
@@ -595,7 +585,6 @@ my $shouldBeAttrs13 = {
'ramfs_fsmods' => '-4',
'ramfs_miscmods' => '-3',
'ramfs_nicmods' => '-2',
- 'ramfs_screen' => '-1',
'automnt_dir' => '1',
'automnt_src' => '2',
@@ -645,7 +634,6 @@ my $shouldBeAttrs33 = {
'ramfs_fsmods' => '-4',
'ramfs_miscmods' => '-3',
'ramfs_nicmods' => '-2',
- 'ramfs_screen' => '-1',
'automnt_dir' => '1',
'automnt_src' => '2',