Skip to content

Conversation

hsahu-ksolves123
Copy link

@hsahu-ksolves123 hsahu-ksolves123 commented Aug 14, 2025

## Summary
Fixes NIFI-14233 where using imported PropertyDescriptor in PropertyDependency causes KeyError crashes in NiFi 2.1.0+.

## Problem

  • When developing Python processors for NiFi, it is often necessary to share properties and methods across multiple processors by placing them into a shared module and importing them into each processor class.

## Solution

  • Enhanced resolve_dependencies() to handle ast.Attribute nodes for imported properties
  • Added dual property lookup: discovered_property_descriptors + module_string_constants

## Testing

  • Added test case verifying ast.Attribute node handling
  • Python syntax validation successful

## Files Changed

  • ProcessorInspection.py - Enhanced dependency resolution method
  • test_fix.py - Verification test for the fix

- Enhanced resolve_dependencies() to handle ast.Attribute nodes for imported properties
- Added dual lookup: discovered_property_descriptors and module_string_constants
- Replaced KeyError crashes with graceful warning logs
- Maintains backward compatibility with existing local property definitions
- Fixes both KeyError (NiFi 2.2.0) and AttributeError (NiFi 2.3.0) issues
- Added test case to verify fix handles ast.Attribute nodes correctly

✅ Full NiFi build completed successfully with changes
- Add Apache license header to test_fix.py for RAT compliance
- Fix variable scoping in resolve_dependencies method
- Ensure proper property resolution for both local and imported descriptors
@hsahu-ksolves123
Copy link
Author

Hi team, I have completed the changes for this ticket and pushed the updates. I haven’t received any feedback yet, so kindly review the PR when you get a chance. Thank you.

Copy link
Contributor

@exceptionfactory exceptionfactory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hsahu-ksolves123 The proposed change has several implementation issues. The resolve_dependencies method should remain unchanged. The visit_Assign method includes code for building up the list of Property Descriptors, so changes should be considered in that method instead.

In addition, the test file is not located in the correct directory. The src/test/python directory contains Python test files. The TestExtensionManager.py is the class that should be updated with a new Processor example, or perhaps a new test class for ProcessorInspection.

If you are able to change the approach and address these issues, please proceed to update this pull request.

@hsahu-ksolves123
Copy link
Author

Okay i will be working on the changes you have suggested to made and update the things accordingly you instructed and will update the pr.

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.

2 participants