Ask Your Question
0

How can I get the nodes pinned in a node group via the REST API?

asked 2018-09-04 17:23:25 -0600

gepandz gravatar image

I'm currently running PE 2017.3.2. We want to dynamically unpin all nodes in a node group when the associated branch is removed by Code Manager when we delete a branch in our control repository. I found the API, https://puppet.com/docs/pe/2017.3/nod..., but I don't see how to get from group name/ID to pinned nodes. The Rules endpoint wouldn't help, since we're looking for nodes pinned by name.

I found the endpoints to pin and unpin nodes (POST /v1/groups/ID/{pin,unpin}, respectively), but can't for the life of me figure out which nodes are currently pinned. Thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-09-06 10:34:46 -0600

kidrock gravatar image

You may have to loop through the results of a query against /v1/classified/nodes (it will have a list of groups for each node) - and then get the actual group names from /v1/groups. I don't know of a way to do it more efficiently, hopefully someone else does.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-09-04 17:23:25 -0600

Seen: 88 times

Last updated: Sep 06