upsert_parameter_to_context failing!
silverbullet1 opened this issue · 2 comments
- Nipyapi version: 0.18.0(also tried on 0.19.0 update)
- NiFi version: 1.13.2
- NiFi-Registry version: N/A
- Python version: 3.9.7
- Operating System: Mac(Also tested on linux)
Description
My code has suddenly started breaking without making any recent change. I was creating parameters and upserting them to a parameter context via the the following piece of code:
def create_parameters(data, parameter_context):
for connection in data:
for key, value in connection.items():
parameter_entity = parameters.prepare_parameter(f"{connection["instance_id"]}_{key}", value)
parameters.upsert_parameter_to_context(parameter_context, parameter_entity)
print(f"Parameter {connection["instance_id"]_{key} created successfully")
time.sleep(5)
This is being invoked with a list with k,v pairs [{k1: v1, k2: v2 ..}] and for parameter_context I am passing
get_parameter_context(nipyapi.canvas.get_root_pg_id())
This code has suddenly stopped working. Its giving the following error:
An exception occurred while creating parameters : 'list' object has no attribute 'component'
What I Did
On some debugging it looks like the upsert command is failing where we are trying to access
context.component.parameters = [parameter]
Urgency
I have neither updated nipyapi nor nifi, and this is why I find this behaviour strange. Please help, as its blocking some critical stuff.
I think someone has changed something in the nifi config from UI, not sure what got changed.
got it, i created another parameter context with same prefix and hence search was giving a list..very stupid of me. Thanks.