Skip to content

PowerNetbox v4.6.0.2 — #418 module auto-loader fix

Choose a tag to compare

@ctrl-alt-automate ctrl-alt-automate released this 15 May 17:24
· 29 commits to main since this release

PowerNetbox v4.6.0.2

Target: NetBox 4.6.0 · Minimum: NetBox 4.3+ · PowerShell: 5.1+ / 7+, cross-platform

Patch release on top of v4.6.0.1. A single targeted bug fix.

Bug fix

#418 — module auto-loader no longer side-loads a second PowerNetbox copy (reported by @danubie, with an exact root-cause diagnosis).

Register-NBArgumentCompleters enumerated the module via Get-Command -Module PowerNetbox during import. That call triggers PowerShell's module auto-loader, which side-loads any PowerNetbox copy found on $env:PSModulePath. A fork developer who also had a PSGallery build installed therefore ended up with two PowerNetbox modules in one session, and Pester aborted with "Multiple script or manifest modules named 'PowerNetbox'".

Fix: the function now resolves the exported function names from the module's own manifest (Import-PowerShellDataFile on PowerNetbox.psd1FunctionsToExport) instead of Get-Command. This is auto-load-free, also fixes the $PSModuleAutoLoadingPreference='None' case @danubie noted, and mirrors whatever deploy.ps1 produced (dev build = all functions, prod = public only).

Two regression tests were added: exactly one PowerNetbox module loaded after import (was two), and Register-NBArgumentCompleters never calling Get-Command. Verified — module count after Import-Module is now 1, and argument completers still register correctly (Get-NBDCIMDevice -Status <TAB> returns its values at real import).

Closes #418. Co-Authored-By @danubie (Matt — Wolfgang Wagner), consistent with how earlier community contributions were credited.

Verification

  • Helpers unit suite: green (incl. the two new #418 regression tests)
  • dev CI green on the merge commit: Tests, Integration matrix (4.3.7 / 4.4.10 / 4.5.10 / 4.6.0), Lint, Secret Scan, docs build — all success
  • No other changes since v4.6.0.1 (3-file delta: the fix + tests + version bump)

🔐 Verify this release against its GitHub build-provenance attestation:

$m = Get-Module -ListAvailable PowerNetbox | Where-Object Version -eq '4.6.0.2' | Select-Object -First 1
gh attestation verify $m.Path --repo ctrl-alt-automate/PowerNetbox