2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-12 17:30:19 +00:00

Reduce duplicate print statement, only print when value does not match

This commit is contained in:
Victor Hu
2018-01-25 13:26:51 -05:00
parent e2d49ce2b2
commit 0a51ba60fd

View File

@ -3626,13 +3626,12 @@ sub rspconfig_api_config_response {
my $last_component = $attr_value[-1];
my @valid_values = values $api_config_info{$::RSPCONFIG_CONFIGURED_API_KEY}{attr_value};
if ($value) {
if ($value ~~ @valid_values) {
# Received one of the expected values (defined in attr_value hash for this command
xCAT::SvrUtils::sendmsg($api_config_info{$::RSPCONFIG_CONFIGURED_API_KEY}{display_name} . " : $last_component", $callback, $node);
} else {
xCAT::SvrUtils::sendmsg($api_config_info{$::RSPCONFIG_CONFIGURED_API_KEY}{display_name} . " : $last_component", $callback, $node);
my $found = grep(/$value/, @valid_values);
if ($found eq 0) {
# Received data value not expected
xCAT::SvrUtils::sendmsg($api_config_info{$::RSPCONFIG_CONFIGURED_API_KEY}{display_name} . " : $last_component", $callback, $node);
xCAT::SvrUtils::sendmsg("Warning: Unexpected value set. Valid values: " . join(",", @valid_values), $callback, $node);
xCAT::SvrUtils::sendmsg("WARNING: Unexpected value set: $value", $callback, $node);
xCAT::SvrUtils::sendmsg("WARNING: Valid values: " . join(",", @valid_values), $callback, $node);
}
}
else {