Closed zakhark closed 7 years ago
2.0.3
12.11.18
mac_os_x 10.10 x86_64 vagrant jhcook/osx-yosemite-10.10
Not able to add users to existing group if gid provided
users_manage "groupname" do group_id 1220 action [ :remove, :create ] end
Only works when this group is created by the same users_manage action, otherwise getting "Chef::Exceptions::Group: gid is already in use”
Created users databag, added a few users and assigned them to groupname Created a recipe file with the following content:
Run kitchen create and then kitchen login and created a group with 'sudo dscl . -create /Groups/groupname gid 1220' Run kitchen converge
Also, it users databag contains a user with the name that matches the groupname, this will fail even if groupname didn't exist on the box before.
Users should be added to the existing group
"Chef::Exceptions::Group: gid is already in use” The same recipe works ok on centos 6.7 and ubuntu 14.04
Recipe: users::groupname * users_manage[groupname] action remove (up to date) * users_manage[groupname] action create ... * group[groupname] action create ================================================================================ Error executing action `create` on resource 'group[groupname]' ================================================================================ Chef::Exceptions::Group ----------------------- gid is already in use Resource Declaration: --------------------- # In /tmp/kitchen/cache/cookbooks/users/providers/manage.rb 170: group new_resource.group_name do 171: gid new_resource.group_id if new_resource.group_id 172: members users_groups[new_resource.group_name] 173: end 174: end Compiled Resource: ------------------ # Declared in /tmp/kitchen/cache/cookbooks/users/providers/manage.rb:170:in `block in class_from_file' group("groupname") do action :create retries 0 retry_delay 2 default_guard_interpreter :default group_name "groupname" gid 1220 members ["user1", "user2", "user3"] declared_type :group cookbook_name "users" end ================================================================================ Error executing action `create` on resource 'users_manage[groupname]' ================================================================================ Chef::Exceptions::Group ----------------------- group[groupname] (/tmp/kitchen/cache/cookbooks/users/providers/manage.rb line 170) had an error: Chef::Exceptions::Group: gid is already in use Resource Declaration: --------------------- # In /tmp/kitchen/cache/cookbooks/users/recipes/groupname.rb 1: users_manage "groupname" do 2: group_id 1220 3: action [ :remove, :create ] 4: end 5: Compiled Resource: ------------------ # Declared in /tmp/kitchen/cache/cookbooks/users/recipes/groupname.rb:1:in `from_file' users_manage("groupname") do action [:remove, :create] updated true updated_by_last_action true retries 0 retry_delay 2 default_guard_interpreter :default declared_type :users_manage cookbook_name "users" recipe_name "groupname" group_id 1220 data_bag "users" search_group "groupname" group_name "groupname" cookbook "users" end [2016-07-06T00:04:43+00:00] ERROR: Converge failed with error message users_manage[groupname] (users::groupname line 1) had an error: Chef::Exceptions::Group: group[groupname] (/tmp/kitchen/cache/cookbooks/users/providers/manage.rb line 170) had an error: Chef::Exceptions::Group: gid is already in use
Cookbook version
2.0.3
Chef-client version
12.11.18
Platform Details
mac_os_x 10.10 x86_64 vagrant jhcook/osx-yosemite-10.10
Scenario:
Not able to add users to existing group if gid provided
Only works when this group is created by the same users_manage action, otherwise getting "Chef::Exceptions::Group: gid is already in use”
Steps to Reproduce:
Created users databag, added a few users and assigned them to groupname Created a recipe file with the following content:
Run kitchen create and then kitchen login and created a group with 'sudo dscl . -create /Groups/groupname gid 1220' Run kitchen converge
Also, it users databag contains a user with the name that matches the groupname, this will fail even if groupname didn't exist on the box before.
Expected Result:
Users should be added to the existing group
Actual Result:
"Chef::Exceptions::Group: gid is already in use” The same recipe works ok on centos 6.7 and ubuntu 14.04