VMware Cloud Community
gok
Contributor
Contributor
Jump to solution

Nagini library in Python not able to get more than 1000 objects

Hello all,

I want to share an issue I found using Nagini library on python environment in order to get and modify data from VROPS

By default the system answer with 1000 object per page as we can see at
https://<vrops-server>/suite-api/api/adapterkinds/VMWARE/resourcekinds/VIRTUALMACHINE/resources

In order to get more objects in the same page you need to pass the maximum number of objects that you want like
https://<vrops-server>/suite-api/api/adapterkinds/VMWARE/resourcekinds/VIRTUALMACHINE/resources/reso...

So as we want to use Nagini Library over python, we need to translate this to Nagini.


Having a look on the Nagini code at the function that we call

find_create_resource_with_adapter_uuid or find_create_resource_with_adapter_key, Nagini use a method called get_resources_with_adapter_and_resource_kind, but in the admitted parameters there is not PageSize

But if we go to the method.json we can see that the option is there
"name" : "get_resources_with_adapter_and_resource_kind",
"url" : "/api/adapterkinds/{adapterKindKey}/resourcekinds/{resourceKindKey}/resources",
"http_method" : "GET",
"doc" : "Query for Resources within a particular Adapter Kind and Resource Kind.
",
"query_params" : [ {
"name" : "page",
"doc" : "Page number from which data needs to be displayed (0-based)",
"type" : "int",
"optional" : true,
"repeating" : false
}, {
"name" : "pageSize",
"doc" : "Expected number of entries per page",
"type" : "int",
"optional" : true,
"repeating" : false },

So I have modify nagini.py on the both functions I commented above to introduce the PageSize as a parameter and magic ... it works !!

Now the question is why to have a Flag and not use it? and why there is not any documentation of Nagini, even if you search in google appear a github from a Harry Potter follower talking something about hacking school....

Message was edited by: Juan Jose Vidañez

Reply
0 Kudos
1 Solution

Accepted Solutions
gok
Contributor
Contributor
Jump to solution

As I commented the answer was in the subject of this sharing

View solution in original post

Reply
0 Kudos
1 Reply
gok
Contributor
Contributor
Jump to solution

As I commented the answer was in the subject of this sharing

Reply
0 Kudos