fix: rename get_users to get_os_users for napalm-device-types 4.7

napalm-device-types 4.7 renamed OSDriver.get_users to get_os_users:
NAPALM's own get_users has another shape and a stub on every driver, so
hasattr could not tell the two apart. BsdDriver now implements
get_os_users with the same return shape and leaves NAPALM's get_users
alone.

Require napalm-device-types>=4.7.1 and bump the version to 0.2.0.
This commit is contained in:
christianmanivong committed 2026-10-13 06:20:00 +00:00
1 parent 2a92ec77e3
commit 1921a3f044
5 files changed
+24 -7

No files matched your search

+10 -3
View File
@@ -96,7 +96,7 @@ class TestIdentity:
"get_route_to",
"get_arp_table",
"get_lldp_neighbors",
"get_users",
"get_os_users",
"get_processes",
"get_cron_jobs",
],
@@ -104,6 +104,13 @@ class TestIdentity:
def test_implements_what_the_poll_reads(self, cls, getter):
"""netOrk asks whether a getter is overridden, not merely present."""
assert getattr(cls, getter) is not getattr(NetworkDriver, getter, None)
assert getattr(cls, getter) is not getattr(OSDriver, getter, None)
@pytest.mark.parametrize("cls", [FreeBSDDriver, OpenBSDDriver])
def test_leaves_napalms_get_users_alone(self, cls):
"""NAPALM's get_users is a different getter; the host's accounts are get_os_users."""
assert "get_users" not in vars(BsdDriver)
assert "get_users" not in vars(cls)
class TestFacts:
@@ -177,8 +184,8 @@ class TestRoutesAndNeighbours:
class TestAccountsAndProcesses:
def test_users(self):
users = _freebsd_host().get_users()
def test_os_users(self):
users = _freebsd_host().get_os_users()
assert next(u for u in users if u["username"] == "root")["groups"] == ["wheel", "operator"]
def test_processes(self):