Chaffelson / nipyapi

A convenient Python wrapper for Apache NiFi
Other
243 stars 76 forks source link

Issue with create_flow_version bucket_id=flow.bucket_identifier #332

Closed jhaabdev closed 8 months ago

jhaabdev commented 10 months ago

Description

I was trying to import a flow into my NiFi registry using nipyapi.versioning.import_flow_version(bucket_id, file_path, flow_id) but I got the following error:

... line 509, in create_flow_version
   bucket_id=flow.bucket_identifier,
AttributeError: 'NoneType' object has no attribute 'bucket_identifier'

From this message, I understand that the flow input parameter of create_flow_version is None meaning something went wrong with the ver_flow object creation in import_flow_version.

I then tried to specify the flow_name instead of the flow_id and that worked well

Maybe it's a usage mistake on my side (maybe I'm not supposed to specify the flow_id when the flow doesn't exist in the registry yet). My use case was that I'm pulling a flow from one registry (dev) and trying to push it in a second repository (prod), so I tried to reuse the flow_id from the first repository (dev) to push into the second (prod).

Urgency

Not urgent

Chaffelson commented 10 months ago

Yeah you have already diagnosed it correctly. The flow_id is specific to the registry, so if you are moving from a dev to a prod registry, then it is only valid for dev.

If you haven't seen it already, there is a demo script walking through promotion of flows like this here