Add env_run_lists attribute to Roles.Get() API
Closed this issue · 4 comments
kvivek1115 commented
At present we have name
, chef_type
, description
, run_list
, default_attributes
, override_attributes
, json_class
attributes. But chef-server roles/NAME
also returned the env_run_lists
attribute as well.
It seems that Chef server API doc https://docs.chef.io/api_chef_server/#get-37 also missing the env_run_lists
.
Knife Chef Server Rest client.
rest.get_rest("/roles/web_server")
{"name"=>"web_server", "description"=>"A role to configure our front-line web servers", "json_class"=>"Chef::Role", "default_attributes"=>{"nginx"=>{"log_location"=>"/var/log/nginx.log"}}, "override_attributes"=>{"nginx"=>{"gzip"=>"on"}}, "chef_type"=>"role", "run_list"=>["recipe[apt]", "recipe[nginx]"], "env_run_lists"=>{"production"=>["recipe[nginx::config_prod]"], "testing"=>["recipe[nginx::config_test]"]}}
Raw Request to get the roles detail:
var v interface{}
req, err := client.NewRequest("GET", "roles/web_server", nil)
res1, err := client.Do(req, &v)
if err != nil {
fmt.Errorf(err.Error())
}
if res1 != nil {
defer res1.Body.Close()
}
fmt.Print(v)
Output:
map[
chef_type:role
default_attributes:map[nginx:map[log_location:/var/log/nginx.log]]
description:A role to configure our front-line web servers
// here it is
env_run_lists:map[
production:[recipe[nginx::config_prod]]
testing:[recipe[nginx::config_test]]]
json_class:Chef::Role
name:web_server
override_attributes:map[nginx:map[gzip:on]]
run_list:[recipe[apt] recipe[Nginx]]
]
MarkGibbons commented
The /roles/NAME/environments/NAME and /roles/NAME/environments endpoints have not been coded yet. PRs with tests would be welcome.
Thanks
kvivek1115 commented
Sure thanks
MarkGibbons commented
Working on it.
MarkGibbons commented
Fixed by #180