You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GET endpoint returns actors, users, clients and groups on root. However PUT endpoint require actors nested users, clients and groups.
I wrote the following verification code.
require 'chef-api'
con = ChefAPI::Connection.new(
client: 'pivotal',
endpoint: 'https://<my_chef_server>/organizations/<my_org>',
flavor: :enterprise,
key: './pivotal.pem'
)
# Match schema of `GET` endpoint
p con.groups.update('admins', groups: ['test_group'])
p con.groups.fetch('admins')
# Match schema of `PUT` endpoint
p con.groups.update('admins', {actors: {groups: ['test_group']}})
p con.groups.fetch('admins')
The output of this code is following. But, test_groups does not belong to admins group after updating.
Description
update
method in Resource::Group cannot update resouces.ChefDK Version
I don't use
chefdk
when I reproduce this issue.I use
chef-api
gem version 0.10.7.Platform Version
Replication Case
This issue seems like that difference schema between GET and PUT is caused.
GET /organizations/NAME/groups/GROUP_NAME
: https://docs.chef.io/api_chef_server/#get-36PUT /organizations/NAME/groups/GROUP_NAME
: https://docs.chef.io/api_chef_server/#put-9GET
endpoint returnsactors
,users
,clients
andgroups
on root. HoweverPUT
endpoint requireactors
nestedusers
,clients
andgroups
.I wrote the following verification code.
The output of this code is following. But,
test_groups
does not belong toadmins
group after updating.Stacktrace
Validation is fixed as #89. So I patched that resources/base.rb#L709 replace
false
toraise
and ran above the verification code.con.groups.update('admins', {actors: {groups: ['test_group']}})
is correct request, but it was failed validation.The text was updated successfully, but these errors were encountered: