-
Notifications
You must be signed in to change notification settings - Fork 75
feat: add Processor and Controller Service Property helpers #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add validation helpers to prevent accidental dynamic property creation when configuring processors and controller services. NiFi silently accepts any property name and creates dynamic properties for unknown keys, which can cause hard-to-debug issues. New functions: - prepare_processor_config: Discover valid property keys or prepare a validated ProcessorConfigDTO - prepare_controller_config: Same for controller services Enhancements: - update_controller: Add auto_disable parameter to automatically disable/re-enable during updates, with error recovery - cli: Disable pager for --help output to prevent agent hangs
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #405 +/- ##
==========================================
+ Coverage 76.56% 76.81% +0.24%
==========================================
Files 41 41
Lines 4780 4831 +51
==========================================
+ Hits 3660 3711 +51
Misses 1120 1120 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add `assets` parameter to accept a list of asset dicts, enabling linking multiple assets to a single parameter (e.g., JMS client JARs). Maintains backward compatibility with existing single-asset usage.
Cover the except block when both the update fails and the attempt to re-enable the controller also fails.
- Move urllib3 import to module level with other imports - Replace conditional PAGER check with os.environ.setdefault() to eliminate branch coverage issue while preserving behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds configuration/validation helpers to reduce accidental dynamic-property creation in NiFi component updates, and extends parameter asset handling to support multiple referenced assets.
Changes:
- Add
prepare_processor_config/prepare_controller_confighelpers to discover valid static keys and validate DTO property updates. - Enhance
update_controllerwith anauto_disableflow (disable → update → restore) and recovery on update failure. - Extend
prepare_parameter_with_assetto support multiple assets with validation; add related test coverage and adjust CLI pager behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
nipyapi/canvas.py |
Adds config preparation/validation helpers and update_controller(auto_disable=...) logic. |
nipyapi/parameters.py |
Extends parameter asset references to support multiple assets and validates argument combinations. |
nipyapi/cli.py |
Sets a default PAGER to avoid interactive paging behavior. |
tests/test_canvas.py |
Adds tests for new config helpers and controller auto-disable behavior, plus property value semantics. |
tests/test_parameters.py |
Adds tests for multi-asset parameters and validation errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Only set PAGER=cat when help is requested or in non-interactive/CI mode - Use sorted() for deterministic error messages in property validation - Improve docstring accuracy for optional parameters in prepare_parameter_with_asset
Add validation helpers to prevent accidental dynamic property creation when configuring processors and controller services. NiFi silently accepts any property name and creates dynamic properties for unknown keys, which can cause hard-to-debug issues.
New functions:
Enhancements:
assetsparameter to accept a list of asset dicts, enabling linking multiple assets to a single parameter (e.g., JMS client JARs). Maintains backward compatibility with existing single-asset usage.