Closed Amorik closed 6 years ago
Hi @Amorik Anything under nipyapi/nifi or nipyapi/registry is procedurally generated from the swagger definition in the main NiFi projects. What this generally means is, while we can change them locally, there's an underlying reason for the mismatch. This then tends to mean one of three things:
I haven't updated the client for the 1.7.0 release yet (working on it), but I will add investigating this to my list for it. If you are interested in investigating this yourself then the process for generating the swagger definition from the main NiFi project, and then base python client, are in the NiPyApi dev notes
@Amorik I've updated NiPy to support NiFi-1.7.1, can you please test nipyapi-0.10.0 and let me know if the ID issue is resolved here?
@Chaffelson issue is not resolved. Same error. Tried 0.10.0 and 0.10.1
Thanks for testing - I'll take another look with @kevdoran
Right, I've reproduced your issue and I think I've found the cause and a possible solution. It looks like in <=NiFi-1.5.0 that call does in fact require an id parameter, but in 1.6.0> it has been deprecated (and now works the same as the NiFi-Registry call).
I think I can fix this by implementing something I've been considering that I'd need for a while, which is version-specific NiFi calls. I'll need to think about the best way to implement this properly, but I'll mock up a fix now to test whether my theory is correct.
Hi @Amorik @kevdoran and I chased this down - I believe that I introduced the problem in 0.9 and hadn't noticed, but it should now be fixed in 0.10.2 if you would care to try it.
@Chaffelson confirmed, working! Sorry it took me a while to get to it. I haven't done anything advanced with it yet but the script above works using 0.10.2. Now i can look at automating Authorizations, woot!
Thanks for taking the time to test it - I'll close this issue now but reopen it if you need to.
Description
In our current docker build/setup we are experiencing some issues with proper policies rights being set. We sought to use nipyapi to correct that. While learning/understanding how to create/modify/delete policy information in NiFi we attempted to use the nipyapi function "nipyapi.security.get_access_policy_for_resource" to view existing information. However using the call, regardless of the variations in options, fails to complete, errors on "TypeError: Got an unexpected keyword argument 'id' to method get_access_policy_for_resource".
What I Did
The test script:
Fails with the following output:
When lookin into the code a bit we can see the call being made to "nipyapi.nifi.PoliciesApi().get_access_policy_for_resource" contains the keyword "id". Following it down to where the error comes from it appears it is just because that key is not listed in "all_params" on line 303 of "policies_api.py". Adding it correct's the behavior, though may not be the right way to fix the issue. It might also appear in other similar calls?
nipyapi/security.py
nipyapi/nifi/apis/policies_api.py
Urgency
Currently in development, nothing is in production today. Started to use nipyapi to automate some initial deployment tasks. We encountering issues with Docker NiFi and policies, hoping to fix them with nipyapi. There are manual work arounds for the time being.