diff options
author | Oliver Tappe | 2008-01-04 01:28:45 +0100 |
---|---|---|
committer | Oliver Tappe | 2008-01-04 01:28:45 +0100 |
commit | 5dea7ec50434d0d9bd1449c5a458d7f2b48e1ffc (patch) | |
tree | 072244a2d0f955a3a7154ca46ec063ef36e6e5fd /config-db/OpenSLX/DBSchema.pm | |
parent | more work at refactoring of the way attributes are handled: (diff) | |
download | core-5dea7ec50434d0d9bd1449c5a458d7f2b48e1ffc.tar.gz core-5dea7ec50434d0d9bd1449c5a458d7f2b48e1ffc.tar.xz core-5dea7ec50434d0d9bd1449c5a458d7f2b48e1ffc.zip |
more work at refactoring of the way attributes are handled:
* finished and integrated support for declaring known attributes from
within plugins (they need to install a AttrInfo module)
* implemented support for checking which attributes are applicable to
systems and clients respectively
* adjusted slxconfig to new attribute handling (systems only at the moment)
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1442 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/OpenSLX/DBSchema.pm')
-rw-r--r-- | config-db/OpenSLX/DBSchema.pm | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/config-db/OpenSLX/DBSchema.pm b/config-db/OpenSLX/DBSchema.pm index 9b692b59..54596c9f 100644 --- a/config-db/OpenSLX/DBSchema.pm +++ b/config-db/OpenSLX/DBSchema.pm @@ -23,10 +23,13 @@ $VERSION = 0.2; @ISA = qw(Exporter); @EXPORT = qw( - $DbSchema %DbSchemaHistory + $DbSchema %DbSchemaHistory %AttributeInfo ); -our ($DbSchema, %DbSchemaHistory); +our ($DbSchema, %DbSchemaHistory, %AttributeInfo); + + +use OpenSLX::Basics; use POSIX qw(locale_h); my $lang = setlocale(LC_MESSAGES); @@ -256,12 +259,22 @@ $DbSchema = { }, { 'system_id' => 0, + 'name' => 'ramfs_miscmods', + 'value' => '', + }, + { + 'system_id' => 0, 'name' => 'ramfs_nicmods', 'value' => 'forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32', }, { 'system_id' => 0, + 'name' => 'ramfs_screen', + 'value' => '', + }, + { + 'system_id' => 0, 'name' => 'sane_scanner', 'value' => '', }, @@ -448,7 +461,7 @@ $DbSchema = { foreach my $key (keys %$system) { next if substr($key, 0, 5) ne 'attr_'; my $attrValue = $system->{$key} || ''; - next if !length($attrValue); + next if $system->{id}>0 && !length($attrValue); my $newAttrName = substr($key, 5); $configDB->setSystemAttr( $system->{id}, $newAttrName, $attrValue @@ -516,4 +529,26 @@ $DbSchema = { ], ); + +################################################################################ +### +### Load all available AttrInfo modules and build the complete hash containing +### info about all known attributes from that. +### +################################################################################ + +%AttributeInfo = (); + +my $libPath = "$openslxConfig{'base-path'}/lib"; +foreach my $module (glob("$libPath/OpenSLX/AttrInfo/*.pm")) { + next if $module !~ m{/([^/]+)\.pm$}; + my $class = "OpenSLX::AttrInfo::$1"; + vlog(2, "loading attr-info from module '$module'"); + my $instance = instantiateClass($class); + my $attrInfo = $instance->AttrInfo(); + foreach my $attr (keys %$attrInfo) { + $AttributeInfo{$attr} = $attrInfo->{$attr}; + } +} + 1; |