fgerlits commented on code in PR #1849:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1849#discussion_r1701403221
##########
extensions/python/pythonprocessors/nifiapi/flowfiletransform.py:
##########
@@ -98,12 +98,15 @@ def onTrigger(self, context: ProcessContext, session:
ProcessSession):
session.transfer(original_flow_file, self.REL_FAILURE)
return
+ result_attributes = result.getAttributes()
if result.getRelationship() == "failure":
session.remove(flow_file)
+ if result_attributes is not None:
+ for attribute in result_attributes:
+ original_flow_file.addAttribute(attribute,
result_attributes[attribute])
Review Comment:
I think
```suggestion
for name, value in result_attributes.items():
original_flow_file.addAttribute(name, value)
```
would be nicer
##########
docker/test/integration/features/python.feature:
##########
@@ -143,3 +143,17 @@ Feature: MiNiFi can use python processors in its flows
When all instances start up
Then one flowfile with the contents "Check successful!" is placed in the
monitored directory in less than 30 seconds
+
+ @USE_NIFI_PYTHON_PROCESSORS
+ Scenario: A MiNiFi instance can update attributes through native python
processor
+ Given a GenerateFlowFile processor with the "File Size" property set to
"0B"
+ And a FailureWithAttributes processor
Review Comment:
We could put an UpdateAttribute before the FailureWithAttributes, to verify
that the attributes are merged, not replaced. Maybe also set an old value for
`error.message`, to verify/document that the existing attribute gets
overwritten.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]