Skip to content

Commit c8e1b1f

Browse files
committed
fix: Correct model_validator parameter in Credential class
- Change parameter from 'data' to 'model' in validate_credential method - Fix return statement to return 'model' instead of undefined 'data' - Resolves AttributeError when accessing credential fields during validation - Fixes startup crash in device configuration loading
1 parent 5dd4a88 commit c8e1b1f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hyperglass/models/config/credential.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class Credential(HyperglassModel, extra="allow"):
2121
_method: t.Optional[AuthMethod] = None
2222

2323
@model_validator(mode="after")
24-
def validate_credential(cls, data: "Credential"):
24+
def validate_credential(cls, model: "Credential"):
2525
"""Ensure either a password or an SSH key is set."""
26-
if data.key is None and data.password is None:
26+
if model.key is None and model.password is None:
2727
raise ValueError(
2828
"Either a password or an SSH key must be specified for user '{}'".format(
29-
data.username
29+
model.username
3030
)
3131
)
32-
return data
32+
return model
3333

3434
def __init__(self, **kwargs):
3535
"""Set private attribute _method based on validated model."""

0 commit comments

Comments
 (0)