feat!: report hosts and licenses as facts, not warnings (0.2.0)
CI / test (3.10) (push) Successful in 27s
CI / test (3.11) (push) Successful in 25s
CI / test (3.12) (push) Successful in 27s
CI / test (3.10) (pull_request) Successful in 27s
CI / test (3.11) (pull_request) Successful in 24s
CI / test (3.12) (pull_request) Successful in 26s
CI / test (3.10) (push) Successful in 27s
CI / test (3.11) (push) Successful in 25s
CI / test (3.12) (push) Successful in 27s
CI / test (3.10) (pull_request) Successful in 27s
CI / test (3.11) (pull_request) Successful in 24s
CI / test (3.12) (pull_request) Successful in 26s
get_device_warnings is gone; netOrk names the warnings from facts (netOrk #1111). get_hypervisor_hosts() reports each host's connection state, maintenance mode, configuration issues and managing vCenter; get_licenses() the assigned licenses with the edition key as edition, never the key itself. The reach stays: the ESXi driver reports connected as None (a disconnected host could not have answered), and managed_by only for a host it reached directly. parse/warnings.py is replaced by parse/hosts.py and parse/licenses.py.
This commit is contained in:
1 parent
276276bd9f
commit
990dfe2f3c
10 files changed
+154
-100
No files matched your search
+17
-3
@@ -72,7 +72,8 @@ class TestIdentity:
|
||||
"rollback_vm_snapshot",
|
||||
"get_vm_storage_pools",
|
||||
"get_virtual_networks",
|
||||
"get_device_warnings",
|
||||
"get_hypervisor_hosts",
|
||||
"get_licenses",
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("cls", DRIVERS)
|
||||
@@ -204,9 +205,22 @@ class TestEsxiGetters:
|
||||
with pytest.raises(RuntimeError, match="no host"):
|
||||
esxi.get_facts()
|
||||
|
||||
def test_warnings(self, esxi, esxi_host):
|
||||
def test_host_facts(self, esxi, esxi_host):
|
||||
esxi_host["runtime.inMaintenanceMode"] = True
|
||||
assert [w["code"] for w in esxi.get_device_warnings()] == ["vmware_host_maintenance_mode"]
|
||||
assert [h["maintenance"] for h in esxi.get_hypervisor_hosts()] == [True]
|
||||
|
||||
def test_license_facts(self, esxi):
|
||||
esxi._inventory.data["licenses"] = [{"editionKey": "esxBasic", "name": "Free"}]
|
||||
assert esxi.get_licenses() == [{"name": "Free", "status": "active", "edition": "esxBasic"}]
|
||||
|
||||
@pytest.mark.parametrize("cls", DRIVERS)
|
||||
def test_no_warnings_of_their_own(self, cls):
|
||||
"""Hosts and licenses are facts; the caller names the warnings (netOrk #1111)."""
|
||||
assert not any(
|
||||
"get_device_warnings" in vars(c)
|
||||
for c in cls.__mro__
|
||||
if c.__module__.startswith("napalm_vmware")
|
||||
)
|
||||
|
||||
def test_storage_and_networks(self, esxi):
|
||||
assert list(esxi.get_vm_storage_pools())
|
||||
|
||||
Reference in new issue
Block a user