Commit 47486438 authored by Matthieu Muffato's avatar Matthieu Muffato Committed by ens-bwalts
Browse files

[ENSCORESW-3002] Forbid setting a resource-class that doesn't exist

parent 231d685a
......@@ -814,15 +814,12 @@ sub apply_tweaks {
my $resource_class;
if($resource_class = $self->collection_of( 'ResourceClass' )->find_one_by( 'name', $new_value )) {
push @response, "Tweak.Found \tresource_class[$new_value_str]\n";
$analysis->resource_class( $resource_class );
$need_write = 1;
} else {
push @response, "Tweak.Adding \tresource_class[$new_value_str]\n";
($resource_class) = $self->add_new_or_update( 'ResourceClass', # NB: add_new_or_update returns a list
'name' => $new_value,
);
$tweakStructure->{Error} = TWEAK_ERROR_MSG->{VALUE_ERROR};
push @response, "Tweak.Error \t'$new_value_str' is not a known resource-class\n";
}
$analysis->resource_class( $resource_class );
$need_write = 1;
}
} elsif( $attrib_name eq 'is_excluded' ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment