Chaffelson / nipyapi

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

deploy_flow_version dont deploy latest version #262

Open GrasOliver opened 3 years ago

GrasOliver commented 3 years ago

Description

Contrary to the documentation that says the latest version would be deployed a random version will be deployed. After a short analysis i think this issue is caused by the fix access of the first list entry in versioning.deploy_flow_version: Line 742 target_flow = target_flow[0].versioned_flow_snapshot_metadata

Also it seems that the self.get_versions_with_http_info(registry_id, bucket_id, flow_id, **kwargs) in get_versions() (Line: 4005, flow_api.py) is always returning the versions in a different order.

What I Did

Commit a Flow that there are 3 Versions in the Nifi-Registry for the Flow. call deploy_flow_version with no version parameter.

Urgency

We can workaround this issue by setting the version attribute to flow.version_count

Kafkalasch commented 1 year ago

I can reproduce it. The issue is here: When providing now version info to deploy_flow_version:

...
if version is None:
        target_flow = flow_versions.versioned_flow_snapshot_metadata_set
...
target_flow = target_flow[0].versioned_flow_snapshot_metadata 
...
// assuming that target_flow[0] is the latest version. But is not, it is in random order as @GrasOliver already wrote
Kafkalasch commented 1 year ago

oh sorry, i read your comment too fast. you basically provided all the information already and my comment brings no additional input.

Chaffelson commented 1 year ago

Ugh that is annoying - I had thought the API returns the versions in a deterministic sort order, perhaps that has changed or it never actually did. We'll patch this for the next version