chef / chef/chef-server

policyfile details API - required associated policy group list with `name` and `no of total nodes` in response

Open
#2,647 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: automate integration
Dominant language
Erlang
Stars
303
Forks
211
Avg merge
1d 8h
Merged PRs (30d)
5

Description

Describe the problem

Using the chef automate we are getting the details of the policy file, we required a list of policy groups with name and no of total nodes in response, we can create a separate API for that, or we can add as additional information with details API.

Replication Case

example like:
request:
https://api.chef-server.dev/organizations/pedant_testorg_api_19024/policies/example-policy. <--- example URL

response we need:

{
    "revision_id": "cc28026f9d52c8856a6d2963b001a60b0b3c0f2d0a7fc72b617c947be3b503bb",
    "name": "test1",
    "run_list": [
       "recipe[viv-test::default]"
    ],
    "included_policy_locks": [
        ....
    ],
    "cookbook_locks": {
        "nginx": {
        ....
        },
        "ohai": {
        ....
        },
        "viv-test": {
        ....
        }
    },
    "default_attributes": {
        ....
    },
    "override_attributes": {
        ....
    },
    "solution_dependencies": {
        ....
    },
    "policy_groups": [  <---------------------------------- policy groups
        {
            name: "test_policy_group",
            total_nodes: 2
        },
        {
            name: "test_policy_group1",
            total_nodes: 3
        }
    ]
}

Stacktrace

Possible Solution

we can also create a new API for the policy file groups
example
request - https://api.chef-server.dev/organizations/pedant_testorg_api_19024/policies/example-policy-name/policy_groups

response:

"policy_groups": [  <---------------------------------- policy groups
        {
            name: "test_policy_group",
            total_nodes: 2
        },
        {
            name: "test_policy_group1",
            total_nodes: 3
        }
    ]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing policy details endpoint at /organizations/{org}/policies/{policy} and compare it with the proposed /policy_groups endpoint. Determine how policy groups and their nodes are represented, then make the selected API return each group's name and total_nodes and verify the response shape.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.