Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ydb/tools/cfg/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
"ic_port": {
"type": "integer",
},
"node_id": {"type": "integer", "minLength": 1},
},
"required": [
"name",
Expand Down Expand Up @@ -946,6 +947,7 @@ def _host_and_ic_port(host):

def checkNameServiceDuplicates(validator, allow_duplicates, instance, schema):
names = collections.Counter([_host_and_ic_port(host) for host in instance])
node_ids = collections.Counter([host["node_id"] for host in instance if host.get("node_id")])

for name, count in names.items():
if count > 1:
Expand All @@ -956,6 +958,15 @@ def checkNameServiceDuplicates(validator, allow_duplicates, instance, schema):
name,
)
)
for node_id, count in node_ids.items():
if count > 1:
yield jsonschema.ValidationError(
"NodeId of items contains non-unique elements %r: %s. "
% (
instance,
node_id,
)
)


_Validator = jsonschema.Draft4Validator
Expand Down