Skip to content

Commit

Permalink
Default to None to compare
Browse files Browse the repository at this point in the history
  • Loading branch information
ecarreras committed Mar 5, 2024
1 parent aee84c1 commit 0876ff7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libcnmc/models/cnmcmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ def __init__(self, *values, **kwvalues):
"""
self.validator = CNMCValidator(self.schema)
stored = namedtuple('{0}_store'.format(self.__class__.__name__), self.fields)
self.store = stored(*values, **kwvalues)
for idx, k in enumerate(self.fields):
if idx < len(values):
kwvalues[k] = values[idx]
elif k not in kwvalues:
kwvalues[k] = None
self.store = stored(**kwvalues)
self.validator.validate(self.store._asdict())
self.store = stored(**self.validator.document)

Expand Down

0 comments on commit 0876ff7

Please sign in to comment.