Skip to content

Commit

Permalink
Merge pull request #105 from tonyandrewmeyer/fix-model-attr-defaults
Browse files Browse the repository at this point in the history
fix: use default_factory to provide default UUID and name values for Model
  • Loading branch information
PietroPasotti authored Mar 22, 2024
2 parents 2e798df + 4519d06 commit d69e183
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scenario/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,8 @@ def _random_model_name():

@dataclasses.dataclass(frozen=True)
class Model(_DCBase):
name: str = _random_model_name()
uuid: str = str(uuid4())
name: str = dataclasses.field(default_factory=_random_model_name)
uuid: str = dataclasses.field(default_factory=lambda: str(uuid4()))

# whatever juju models --format=json | jq '.models[<current-model-index>].type' gives back.
# TODO: make this exhaustive.
Expand Down

0 comments on commit d69e183

Please sign in to comment.