forked from rucio/rucio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…cio#4845 Currently, a misleading error message is raised to the user upon attempting to move a rule which has an invalid Source Replica Expression. An invalid Source Replica Expression is an RSE expression which evaluates to an empty set, which can occur due to a variety of reasons. The misleading error message informs the user that the provided `RSE expression is considered invalid`, this is misleading, since the error does not stem from the RSE expression provided to the `move_rule` command. Instead, the failure lies in parsing the Source Replica Expression (which may come as an attribute of the rule prior to moving/updating it, or be provided by the user as an additional argument). This failure is then not communicated to the user in a clear manner. The solution is to introduce a new exception `InvalidSourceReplicaExpression` and raise it within `core/rule.py::add_rule`, should the attempt to parse the Source Replica Expression with `parse_expression` fail. This commit also includes a test added to `test_rule.py::TestCore` which simulates two ways in which the Source Replica Expression might become invalid: 1) By deleting the only RSE the Source Replica Expression points to. 2) By matching the RSE to the Source Replica Expression via an RSE attribute but then deleting this RSE attribute from the RSE. In both cases the Source Replica Expression will evaluate to an empty set. The test makes use of the `caches_mock`-fixture to override the internal cache of `rse_expression_parser`. Since the parser caches previously parsed expressions, access to the cache is necessary to clear the cache after altering the RSE (either by deleting the RSE or by deleting an attribute of the RSE).
- Loading branch information
Showing
3 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters