Skip to content

fix(plugins): resolve plugin paths using directory tree - #1424

Merged
ne-cdietsch merged 4 commits into
dev-v3.5.0from
cpd-investigate-plugins-file-paths
Aug 7, 2026
Merged

fix(plugins): resolve plugin paths using directory tree#1424
ne-cdietsch merged 4 commits into
dev-v3.5.0from
cpd-investigate-plugins-file-paths

Conversation

@ne-cdietsch

@ne-cdietsch ne-cdietsch commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • Run python -m unittest test_pluginnodes -v from the test/ directory
  • Place get_script_dir.ps1 (or .sh on Linux) in the plugins root and confirm check_ncpa.py -M 'plugins/get_script_dir.ps1' reports the root directory
  • Copy the same file to plugins/old/ and confirm the same command still runs the root copy
  • Confirm plugins/old/get_script_dir.ps1 runs the subdirectory copy when requested explicitly
  • Confirm /api/plugins lists both root and subdirectory plugins with relative paths

@ne-cdietsch

ne-cdietsch commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Possible breaking changes

This fix changes how plugins are discovered and resolved. Most existing checks should keep working, but some may need updates.

Duplicate filenames (most likely impact)

Previously, if the same filename existed in the plugins root and a subdirectory (e.g. plugins/check_disk.sh and plugins/old/check_disk.sh), NCPA kept only one entry and the subdirectory copy could overwrite the root copy. A request to plugins/check_disk.sh might have been running the subdirectory version.

After this change:

plugins/check_disk.sh always runs the root-level file
plugins/old/check_disk.sh runs the subdirectory file

Action required: If a check was intentionally using the subdirectory copy while calling plugins/ (without the subdirectory path), update it to the full relative path, e.g. plugins/old/check_disk.sh.

Checks that target a root-level plugin and have no duplicate filename elsewhere are unaffected.

Checks using subdirectory plugins

If you were running a plugin that lives in a subdirectory (e.g. plugins/old/check_disk.sh) by calling it without the subdirectory path — for example:

check_ncpa.py -H server -t TOKEN -M 'plugins/check_disk.sh'
—that may have worked before only because NCPA indexed plugins by filename alone.

With this fix, plugins/check_disk.sh always runs the root-level file. To run the subdirectory copy, update the check to include the full relative path:

check_ncpa.py -H server -t TOKEN -M 'plugins/old/check_disk.sh'
The same applies to passive checks, NCPA config, or any other reference that used only the basename for a plugin in a subdirectory.

Plugin inventory API

GET /api/plugins now lists subdirectory plugins with their relative path (e.g. old/check_disk.sh), not only root-level basenames. Anything that parses this response and assumes every entry is a root-level filename may need to be updated.

What does not require changes

Checks using plugins/ for a plugin that exists only at the root level
Checks already using an explicit subdirectory path (these may start working where they previously failed)

@ne-cdietsch
ne-cdietsch merged commit a6db5b2 into dev-v3.5.0 Aug 7, 2026
71 of 72 checks passed
@ne-cdietsch
ne-cdietsch deleted the cpd-investigate-plugins-file-paths branch August 7, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant