Skip to content
Snippets Groups Projects
Commit fb0da590 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

* Fix handling of config attributes

parent 59b73b4c
No related branches found
No related tags found
No related merge requests found
...@@ -430,57 +430,41 @@ sub checkAttributeConfig ...@@ -430,57 +430,41 @@ sub checkAttributeConfig
@attrValues = ( $attribute->{'Value'} ); @attrValues = ( $attribute->{'Value'} );
} }
$server->log(LOG_DEBUG,"[ATTRIBUTES] Processing CONFIG attribute value ".niceUndef($attrVal)." against: '". $server->log(LOG_DEBUG,"[ATTRIBUTES] Processing CONFIG attribute: '".$attribute->{'Name'}."' ".
$attribute->{'Name'}."' ".$attribute->{'Operator'}." '".join("','",@attrValues)."'"); $attribute->{'Operator'}." '".join("','",@attrValues)."'");
# Loop with all the test attribute values # FIXME
foreach my $tattrVal (@attrValues) { # Operator: +=
#
# FIXME # Use: Attribute += Value
# Operator: += # Always matches as a check item, and adds the current
# # attribute with value to the list of configuration items.
# Use: Attribute += Value #
# Always matches as a check item, and adds the current # As a reply item, it has an itendtical meaning, but the
# attribute with value to the list of configuration items. # attribute is added to the reply items.
#
# As a reply item, it has an itendtical meaning, but the if ($attribute->{'Operator'} eq '+=') {
# attribute is added to the reply items. $server->log(LOG_DEBUG,"[ATTRIBUTES] Operator '+=' triggered: Adding item to configuration items.");
push(@{$configAttributes->{$attribute->{'Name'}}},@attrValues);
if ($attribute->{'Operator'} eq '+=') {
$server->log(LOG_DEBUG,"[ATTRIBUTES] Operator '+=' triggered: Adding item to configuration items."); # FIXME
$matched = 1; # Operator: :=
#
# FIXME # Use: Attribute := Value
# Operator: := # Always matches as a check item, and replaces in the configuration items any attribute of the same name.
# # If no attribute of that name appears in the request, then this attribute is added.
# Use: Attribute := Value #
# Always matches as a check item, and replaces in the configuration items any attribute of the same name. # As a reply item, it has an itendtical meaning, but for the reply items, instead of the request items.
# If no attribute of that name appears in the request, then this attribute is added.
# } elsif ($attribute->{'Operator'} eq ':=') {
# As a reply item, it has an itendtical meaning, but for the reply items, instead of the request items. $server->log(LOG_DEBUG,"[ATTRIBUTES] Operator ':=' triggered: Adding or replacing item in configuration items.");
@{$configAttributes->{$attribute->{'Name'}}} = @attrValues;
} elsif ($attribute->{'Operator'} eq ':=') {
$server->log(LOG_DEBUG,"[ATTRIBUTES] Operator ':=' triggered: Adding or replacing item in configuration items."); # Operators that are not defined
$matched = 1;
# Attributes that are not defined
} else {
# Ignore
$matched = 2;
last;
}
}
# Some debugging info
if ($matched == 1) {
$server->log(LOG_DEBUG,"[ATTRIBUTES] - Attribute '".$attribute->{'Name'}."' matched");
} elsif ($matched == 2) {
$server->log(LOG_DEBUG,"[ATTRIBUTES] - Attribute '".$attribute->{'Name'}."' ignored");
} else { } else {
$server->log(LOG_DEBUG,"[ATTRIBUTES] - Attribute '".$attribute->{'Name'}."' not matched"); # Ignore
$server->log(LOG_DEBUG,"[ATTRIBUTES] - Attribute '".$attribute->{'Name'}."' ignored");
} }
return $matched;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment