Skip to content

Commit

Permalink
SIMPLE-6087 creating a lab no longer raises a warning (#74)
Browse files Browse the repository at this point in the history
* SIMPLE-6087 creating a lab no longer raises a warning

---------

Co-authored-by: tmikuska <[email protected]>
  • Loading branch information
daniel-valent and tmikuska authored Dec 8, 2023
1 parent 2136fc3 commit 791efb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 8 additions & 5 deletions virl2_client/models/lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,11 +1188,14 @@ def _import_lab(self, topology: dict) -> None:
lab_dict = topology.get("lab")

if lab_dict is None:
warnings.warn(
"Labs created in older CML releases (schema version 0.0.5 or lower) "
"are deprecated. Use labs with schema version 0.1.0 or higher.",
DeprecationWarning,
)
# If we just created the lab, we skip the warning, since the
# lab post endpoint returns data in the old format
if not topology.pop("_created", False):
warnings.warn(
"Labs created in older CML releases (schema version 0.0.5 or lower)"
" are deprecated. Use labs with schema version 0.1.0 or higher.",
DeprecationWarning,
)
self._title = topology["lab_title"]
self._description = topology["lab_description"]
self._notes = topology["lab_notes"]
Expand Down
2 changes: 2 additions & 0 deletions virl2_client/virl2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,8 @@ def create_lab(
wait_time=self.convergence_wait_time,
resource_pool_manager=self.resource_pool_management,
)
# This is just to skip a deprecation warning in _import_lab
result["_created"] = True
lab._import_lab(result)
self._labs[lab_id] = lab
return lab
Expand Down

0 comments on commit 791efb9

Please sign in to comment.