nipyapi
nipyapi copied to clipboard
deploy_flow_version dont deploy latest version
- Nipyapi version: 0.16.1
- NiFi version: 1.11.4
- NiFi-Registry version: 0.6.0
- Python version: 3.8.3
- Operating System:
-
- Windows 10 64-Bit local dev-machine
-
- centos 7: productive machine
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
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
oh sorry, i read your comment too fast. you basically provided all the information already and my comment brings no additional input.
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