Skip to content

Commit ac5f4d6

Browse files
committed
Deprecated the nodes property
1 parent 1ca1f86 commit ac5f4d6

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

virl2_client/models/lab.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,8 @@ def update_lab_groups(
21352135
:returns: Updated objects consisting of group ID and permissions.
21362136
"""
21372137
warnings.warn(
2138-
"'Lab.update_lab_groups()' is deprecated. Use '.update_associations()' instead.",
2138+
"'Lab.update_lab_groups()' is deprecated. Use '.update_associations()'"
2139+
" instead.",
21392140
DeprecationWarning,
21402141
)
21412142
url = self._url_for("lab")

virl2_client/models/system.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import logging
2424
import time
2525
from typing import TYPE_CHECKING, Any
26+
import warnings
2627

2728
from virl2_client.exceptions import ControllerNotFound
2829

@@ -398,7 +399,9 @@ def __init__(
398399
:param is_connected: Whether the compute host is connected.
399400
:param is_synced: Whether the compute host is synced.
400401
:param admission_state: The admission state of the compute host.
401-
:param nodes: The list of nodes associated with the compute host.
402+
:param node_counts: The counts of deployed and running nodes and orphans.
403+
:param nodes: DEPRECATED: replaced by node_counts.
404+
The list of node IDs associated with the compute host.
402405
"""
403406
self._system = system
404407
self._session: httpx.Client = system._session
@@ -468,13 +471,18 @@ def is_synced(self) -> bool:
468471

469472
@property
470473
def node_counts(self) -> dict[str, int]:
471-
"""Return the count of deployed and running nodes and orphans."""
474+
"""Return the counts of deployed and running nodes and orphans."""
472475
self._system.sync_compute_hosts_if_outdated()
473476
return self._node_counts
474477

475478
@property
476479
def nodes(self) -> list[str]:
477480
"""Return the list of nodes associated with the compute host."""
481+
warnings.warn(
482+
"'ComputeHost.nodes()' is deprecated. Use 'ComputeHost.node_counts()'"
483+
" instead.",
484+
DeprecationWarning,
485+
)
478486
self._system.sync_compute_hosts_if_outdated()
479487
return self._nodes
480488

0 commit comments

Comments
 (0)