Skip to content

Commit

Permalink
Fix #647, fix #909 - Always parse delete object non-strict
Browse files Browse the repository at this point in the history
When an object is deleted, the submitted object's values are
ignored except for the primary key. Therefore, there's no
need to validate them in strict mode.
This also disables the rules validator for deletion objects, re #909
  • Loading branch information
mxsasha committed Feb 26, 2024
1 parent 39cc81a commit 3239354
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion irrd/updates/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(
)
except ValueError:
pass
if self.non_strict_mode:
if self.non_strict_mode or delete_reason:
self.rpsl_obj_new = rpsl_object_from_text(rpsl_text_submitted, strict_validation=False)

if self.rpsl_obj_new.messages.errors():
Expand Down
7 changes: 1 addition & 6 deletions irrd/updates/tests/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,6 @@ def test_parse_invalid_object_delete_syntax(self, prepare_mocks):
{"name": "person", "value": "Placeholder Person Object"},
{"name": "nic-hdl", "value": "PERSON-TEST"},
{"name": "changed", "value": "changed@example.com 20190701 # comment"},
{"name": "source", "value": "TEST"},
]
},
],
Expand Down Expand Up @@ -1110,12 +1109,8 @@ def test_parse_invalid_object_delete_syntax(self, prepare_mocks):
person: Placeholder Person Object
nic-hdl: PERSON-TEST
changed: changed@example.com 20190701 # comment
source: TEST
ERROR: Mandatory attribute "address" on object person is missing
ERROR: Mandatory attribute "phone" on object person is missing
ERROR: Mandatory attribute "e-mail" on object person is missing
ERROR: Mandatory attribute "mnt-by" on object person is missing
ERROR: Primary key attribute "source" on object person is missing
ERROR: Can not delete object: no object found for this key in this database.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 3239354

Please sign in to comment.