summaryrefslogtreecommitdiffstats
path: root/config-db
diff options
context:
space:
mode:
authorOliver Tappe2008-03-17 23:24:15 +0100
committerOliver Tappe2008-03-17 23:24:15 +0100
commit480019c4ae2bb212aa0af065d77d169fa6550598 (patch)
tree395789f95dffa98b679228aa6b9e751208037045 /config-db
parent* fixed bug in addAllStage3AttributesToHash() - the actual filtering was missing (diff)
downloadcore-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')
-rw-r--r--config-db/OpenSLX/ConfigDB.pm35
-rwxr-xr-xconfig-db/slxconfig2
-rwxr-xr-xconfig-db/slxconfig-demuxer11
3 files changed, 37 insertions, 11 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;
diff --git a/config-db/slxconfig b/config-db/slxconfig
index 1d1ddf29..5825eac0 100755
--- a/config-db/slxconfig
+++ b/config-db/slxconfig
@@ -1335,7 +1335,7 @@ sub _expandSystems
my $mergedSystem = dclone($_);
my $originInfo = {};
$openslxDB->mergeDefaultAttributesIntoSystem(
- $mergedSystem, $originInfo
+ $mergedSystem, \@installedPlugins, $originInfo
);
my $mergedAttrs = $mergedSystem->{attrs} || {};
foreach my $plugin (@installedPlugins) {
diff --git a/config-db/slxconfig-demuxer b/config-db/slxconfig-demuxer
index bc1c23be..03d2ca2e 100755
--- a/config-db/slxconfig-demuxer
+++ b/config-db/slxconfig-demuxer
@@ -668,7 +668,8 @@ sub writePluginConfigurationsForSystem
my $attrs = $info->{attrs} || {};
my @activePlugins;
- foreach my $pluginName (@{$info->{'installed-plugins'}}) {
+ foreach my $pluginInfo (@{$info->{'installed-plugins'}}) {
+ my $pluginName = $pluginInfo->{plugin_name};
vlog(2, _tr("checking configuration of plugin '%s'", $pluginName));
# skip inactive plugins
@@ -686,7 +687,9 @@ sub writePluginConfigurationsForSystem
my @pluginAttrs = grep { $_ =~ m{^${pluginName}::} } keys %$attrs;
foreach my $attr (sort @pluginAttrs) {
my $attrVal = $attrs->{$attr};
- next if !defined $attrVal;
+ if (!defined $attrVal) {
+ $attrVal = '';
+ }
my $attrName = substr($attr, index($attr, '::')+2);
$content .= qq[${pluginName}_$attrName="$attrVal"\n];
}
@@ -721,7 +724,9 @@ sub writeSystemConfiguration
my $buildPath = "$tempPath/build";
copyExternalSystemConfig(externalIDForSystem($info), $buildPath);
- $openslxDB->mergeDefaultAttributesIntoSystem($info);
+ $openslxDB->mergeDefaultAttributesIntoSystem(
+ $info, $info->{'installed-plugins'}
+ );
$info->{'attr-digest'} = digestAttributes($info);
vlog(
2,