Fetch Container Nodes By Tag (REST Query)

Hi ,

I have tagged my nodes with my custom tags, now what I want is to retrieve all the nodes which I tagged.
Lets say I tagged some nodes with tag master now I want to get this nodes from my provider?

Currently, I have a following query to fetch all the container nodes:
curl -g -u username:password -X GET http://localhost:3000/api/providers/1?attributes=container_nodes
This gives me all the node for provider 1, I tried by_tag in query paramter but it doesn’t seems to work for me.

Any idea how to get container nodes by tag??

If there is a way to fetch all the tagged nodes from all the providers even better :slight_smile:

Tagging @Fryguy @chessbyte @Yaacov_Zamir @abonas



This would have been possible if container_nodes is exposed as a sub-collection to providers, but it’s not today.

The one option is to browse it as a primary collection:

GET /api/container_nodes?filter[]=ems_id=1&by_tag=/tag/path


Thanks @Yaacov_Zamir and @abellotti for the reply.

Do you have any plans to expose the container_nodes endpoint in near future? Please share if you have any update regarding this.

This was already been asked here, there are other people who are also looking for this feature.

Exposing container_nodes would be very helpful as this would be a key to automate things from our end.

EDIT: I tried this :
curl -g -u admin:smartvm -X GET http://localhost:3000/api/container_nodes
And got following error:
The page you were looking for doesn't exist (404)
So, this(as @abellotti said on his comment) :

GET /api/container_nodes?filter[]=ems_id=1&by_tag=/tag/path

would work in the future and is not available currently. Correct me if I am wrong.

I wanted to add more thing:
From the UI I can filter container_nodes by tags but not through REST :frowning:

Also, I was browsing through the manageiQ repo I saw that currently container_nodes exposed as collection , so I believe this path api/container_nodes should exists but it doesn’t :frowning: .

@abellotti any views on this?

I just verifying master, GET /api/container_nodes is working fine for me.

PR was merged about 3 weeks ago as per: https://github.com/ManageIQ/manageiq-api/pull/129.

are you running latest master ? what error are you seeing ?

I use the one from here it seems that I use fine-4 it was last updated 3 weeks ago and if the code was merged 15 days ago then it should work for fine-4 tag.

Error message:

[root@d166e5c9a8d2 vmdb]# curl -g -u admin:smartvm -X GET http://localhost:3000/api/container_nodes

The page you were looking for doesn't exist (404) body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } div.dialog { width: 25em; padding: 0 4em; margin: 4em auto 0 auto; border: 1px solid #ccc; border-right-color: #999; border-bottom-color: #999; } h1 { font-size: 100%; color: #f00; line-height: 1.5em; }

The page you were looking for doesn't exist.

You may have mistyped the address or the page may have moved.

code is only on master and gaprindashvili branch, it would not have been merged to the fine release.

/cc @simaishi do we have a gaprindashvili docker build ?

Thanks @abellotti if I can have the docker build that would be great.

Yes, Gaprindashvili docker build is available and can be pulled using:

docker pull manageiq/manageiq:latest-gaprindashvili

1 Like

Thanks I have the endpoint if I use the docker image latest-gaprindashvili.

@simaishi Thanks for sharing the docker tag, I am using that only but I have trouble(can add a provider but can’t see any pods,containers etc all are showing zero…zero) adding provider. I worked with fine-4 version and in that version adding a provider work seamlessly.

Did you observed any issue while adding a provider on gaprindashvili?

@sabeer6870 The ‘gaprindashvili’ branch is still under development and there are many changes coming in every day. Since it’s very hard to tell what issues exist/fixed in certain builds, it’s probably best that you wait until we have more stable gaprindashvili build.

@simaishi Thanks for the prompt reply, I will wait :slight_smile:

@abellotti one last question: do you know in which version of the Cloudform the endpoint: /api/container_nodes will be available?

If it is in gaprindashvili, it should be in Cloudforms 5.9.0.
See also https://bugzilla.redhat.com/show_bug.cgi?id=1500073