chore: adopt the NAPALM driver standard #8

Merged
christianmanivong merged 4 commits from chore/driver-standard into main 2026-10-23 10:43:57 +00:00
Owner

Summary

napalm-vmware adopts the NAPALM driver standard (https://git.netork.io/NAPALM/driver-standard).
Epic: NAPALM/driver-standard#2.

Changes

  • style: ruff format and ruff check --fix with the standard's rule set (E, F, I, UP, B, line length 100, Python 3.10). Mechanical.
  • fix: zip(..., strict=True) in provisioning (B905): the OVF asks for one adapter per requested NIC, so a VM that comes back with fewer adapters now fails (and is discarded like any other failure after the import) instead of getting a seed that leaves a NIC unconfigured; a test covers it. A failed abort of the import lease is logged at debug level (B110). Justified nosec for false positives: 0.0.0.0 in the parsers is data vSphere reports (B104); qemu-img runs with a fixed argv and no shell (B404, B603); xml.sax.saxutils only escapes the OVF descriptor the driver writes, nothing is parsed (B406), so defusedxml does not apply.
  • chore: CI in .gitea/workflows/ci.yml calling the shared driver workflow, .github/ removed; setuptools>=77, SPDX license string, napalm-device-types>=4.21.1, dev extra, Issues/Changelog links; README installs from PyPI; strict mypy with eleven modules exempt for now (_inventory, _session, _tasks, base, esxi, parse.environment, parse.snapshots, parse.vm_devices, provision.seed, provision.transfer, provisioning; 35 errors); quality baseline written; coverage floor 97 %.

Related Issue

Closes #7

Testing

Locally: 296 tests (7 vcsim tests skipped), coverage 97.11 %, ruff, mypy, bandit clean; napalm-standard check and ratchet clean; build + twine check --strict pass.

## Summary napalm-vmware adopts the NAPALM driver standard (https://git.netork.io/NAPALM/driver-standard). Epic: NAPALM/driver-standard#2. ## Changes - **style**: `ruff format` and `ruff check --fix` with the standard's rule set (E, F, I, UP, B, line length 100, Python 3.10). Mechanical. - **fix**: `zip(..., strict=True)` in provisioning (B905): the OVF asks for one adapter per requested NIC, so a VM that comes back with fewer adapters now fails (and is discarded like any other failure after the import) instead of getting a seed that leaves a NIC unconfigured; a test covers it. A failed abort of the import lease is logged at debug level (B110). Justified `nosec` for false positives: `0.0.0.0` in the parsers is data vSphere reports (B104); qemu-img runs with a fixed argv and no shell (B404, B603); `xml.sax.saxutils` only escapes the OVF descriptor the driver writes, nothing is parsed (B406), so defusedxml does not apply. - **chore**: CI in `.gitea/workflows/ci.yml` calling the shared driver workflow, `.github/` removed; `setuptools>=77`, SPDX license string, `napalm-device-types>=4.21.1`, dev extra, Issues/Changelog links; README installs from PyPI; strict mypy with eleven modules exempt for now (`_inventory`, `_session`, `_tasks`, `base`, `esxi`, `parse.environment`, `parse.snapshots`, `parse.vm_devices`, `provision.seed`, `provision.transfer`, `provisioning`; 35 errors); quality baseline written; coverage floor 97 %. ## Related Issue Closes #7 ## Testing Locally: 296 tests (7 vcsim tests skipped), coverage 97.11 %, ruff, mypy, bandit clean; `napalm-standard check` and `ratchet` clean; build + `twine check --strict` pass.
christianmanivong added 3 commits 2026-10-23 06:40:55 +00:00
Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM
driver uses (E, F, I, UP, B at line length 100, Python 3.10). What ruff
cannot fix comes in the next commit.
- zip() in provisioning is strict (B905): the OVF asks for one adapter
  per requested NIC, so the two lists match. A VM that came back with
  fewer adapters used to get a seed that left a NIC unconfigured; it now
  fails, and create_vm_from_cloud_init discards it as on any other error
  after the import. A test covers it.
- A failed abort of the import lease is logged at debug level instead of
  passed over (B110); the original error is still the one raised.
- nosec for false positives, each with its reason: the 0.0.0.0 entries in
  the parsers are addresses vSphere reports, not binds (B104); qemu-img
  runs with a fixed argv and no shell (B404, B603); xml.sax.saxutils only
  escapes the OVF descriptor the driver writes, nothing is parsed (B406),
  so defusedxml would not apply.
chore: adopt the NAPALM driver standard
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 11s
driver / types (pull_request) Successful in 46s
driver / test (3.10) (pull_request) Successful in 50s
driver / test (3.11) (pull_request) Successful in 48s
driver / test (3.12) (pull_request) Successful in 49s
driver / test (3.13) (pull_request) Successful in 42s
driver / lowest (pull_request) Successful in 24s
driver / security (pull_request) Successful in 46s
driver / build (pull_request) Successful in 22s
CI / driver (pull_request) Successful in 5m52s
driver / publish (pull_request) Skipped
24617b7f82
- CI moves to .gitea/workflows/ci.yml and calls the shared driver workflow
  of NAPALM/driver-standard; .github/ is gone.
- setuptools>=77 with the SPDX license string, no License classifier,
  Python 3.13 classifier, napalm-device-types>=4.21.1, a dev extra with
  floors, Issues and Changelog links; README installs from PyPI and links
  pyVmomi on PyPI.
- mypy strict for the package (the blanket ignore_missing_imports is now
  limited to napalm and yaml); exempt for now (35 errors): _inventory,
  _session, _tasks, base, esxi, parse.environment, parse.snapshots,
  parse.vm_devices, provision.seed, provision.transfer, provisioning.
  Recorded in the quality baseline with the long and complex functions.
- Coverage floor 97 % (measured 97.11 %).
christianmanivong added 1 commit 2026-10-23 08:29:10 +00:00
chore(release): 0.3.0
driver / standard (pull_request) Successful in 13s
driver / lint (pull_request) Successful in 11s
driver / types (pull_request) Successful in 48s
driver / test (3.10) (pull_request) Successful in 50s
driver / test (3.11) (pull_request) Successful in 49s
driver / test (3.12) (pull_request) Successful in 49s
driver / test (3.13) (pull_request) Successful in 43s
driver / lowest (pull_request) Successful in 24s
driver / security (pull_request) Successful in 47s
driver / build (pull_request) Successful in 23s
CI / driver (pull_request) Successful in 5m57s
driver / publish (pull_request) Skipped
46b595e8ba
christianmanivong merged commit e235eb96b4 into main 2026-10-23 10:43:57 +00:00
christianmanivong deleted branch chore/driver-standard 2026-10-23 10:43:58 +00:00
Sign in to join this conversation.