diff options
author | Oliver Tappe | 2008-03-17 23:24:15 +0100 |
---|---|---|
committer | Oliver Tappe | 2008-03-17 23:24:15 +0100 |
commit | 480019c4ae2bb212aa0af065d77d169fa6550598 (patch) | |
tree | 395789f95dffa98b679228aa6b9e751208037045 /config-db/OpenSLX | |
parent | * fixed bug in addAllStage3AttributesToHash() - the actual filtering was missing (diff) | |
download | core-480019c4ae2bb212aa0af065d77d169fa6550598.tar.gz core-480019c4ae2bb212aa0af065d77d169fa6550598.tar.xz core-480019c4ae2bb212aa0af065d77d169fa6550598.zip |
* fixed several bugs in the config-demuxer caused by recent changes in plugin
code (the way plugin info is returned from DB)
* Added support to mergeDefaultAttributesIntoSystem() for merging in attributes
that are stored in the installed plugins of the corresponding vendor-OS.
The new order for system attribute selection is:
1. default client
2. specific system
3. vendor-OS (plugin attributes only)
4. default system
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1648 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/OpenSLX')
-rw-r--r-- | config-db/OpenSLX/ConfigDB.pm | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/config-db/OpenSLX/ConfigDB.pm b/config-db/OpenSLX/ConfigDB.pm index 4b13c3f5..5c49646e 100644 --- a/config-db/OpenSLX/ConfigDB.pm +++ b/config-db/OpenSLX/ConfigDB.pm @@ -2406,8 +2406,8 @@ sub emptyDatabase =item C<mergeDefaultAttributesIntoSystem($system)> -merges default system attributes into the given system hash and pushes the default -client attributes on top of that. +merges vendor-OS-specific plugin attributes and default system attributes into +the given system hash, and pushes the default client attributes on top of that. =over @@ -2425,13 +2425,31 @@ none sub mergeDefaultAttributesIntoSystem { - my $self = shift; - my $system = shift; - my $originInfo = shift; + my $self = shift; + my $system = shift; + my $installedPlugins = shift; + my $originInfo = shift; + # first look into default system my $defaultSystem = $self->fetchSystemByFilter({name => '<<<default>>>'}); mergeAttributes($system, $defaultSystem, $originInfo, 'default-system'); + # then merge any attributes found in the plugins that are installed + # into the vendor-OS: + if (ref $installedPlugins eq 'ARRAY' && @$installedPlugins) { + for my $plugin (@$installedPlugins) { + mergeAttributes($system, $plugin, $originInfo, 'vendor-OS'); + } + + # the above will have merged stage1 attributes, too, so we remove + # these from the resulting system (as they do not apply to systems) + my @stage3AttrNames = OpenSLX::AttributeRoster->getStage3Attrs(); + for my $attr (keys %{$system->{attrs}}) { + next if grep { $attr eq $_ } @stage3AttrNames; + delete $system->{attrs}->{$attr}; + } + } + my $defaultClient = $self->fetchClientByFilter({name => '<<<default>>>'}); pushAttributes($system, $defaultClient, $originInfo, 'default-client'); @@ -2709,8 +2727,11 @@ sub mergeAttributes foreach my $key (keys %$sourceAttrs) { my $sourceVal = $sourceAttrs->{$key}; my $targetVal = $targetAttrs->{$key}; - if (defined $sourceVal && !defined $targetVal) { - vlog(3, _tr("merging %s (val=%s)", $key, $sourceVal)); + if (!defined $targetVal) { + vlog(3, _tr( + "merging %s (val=%s)", $key, + defined $sourceVal ? $sourceVal : '' + )); $targetAttrs->{$key} = $sourceVal; if (defined $originInfo) { $originInfo->{$key} = $origin; |