sous-chefs / users

Development repository for the users cookbook
https://supermarket.chef.io/cookbooks/users
Apache License 2.0
138 stars 217 forks source link

Allow "group_id" in data bag to be named group, without breaking group based account management. #135

Closed nkadel-skyhook closed 7 years ago

nkadel-skyhook commented 8 years ago

With chefdk 0.11.0 on RHEL 6, using chef-solo for local data bags, and trying to create an account called "myname", I can set up an internal recipe to give that specific account a private called "myname" and set the gid based on that private group, and set the "group_id" in the databag to use the already created group called "myname", rather than having to write and synchronize the numeric gid in several places.

So far, so good.

However, , later running an internal recipe that activates a new group, such as "sysadmins", a group for which "myname" is a member, I get errors like this:

Generated at 2016-02-26 03:29:20 -0500 Chef::Exceptions::Exec: users_manage[sysadmin](local_users::sysadmin line 16) had an error: Chef::Exceptions::Exec: group[myname](/var/chef-solo/berks-cookbooks/users/providers/manage.rb line 162) had an error: Chef::Exceptions::Exec: groupmod -g 'myname' myname returned 3, expected 0 /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/mixin/command.rb:158:in handle_command_failures' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/mixin/command.rb:104:inrun_command_and_return_stdout_stderr'

[spew deleted]

Notice the attempt to use "groupmod -g 'myname'", which shouldn't be necessary. The groupid is already correct. for the primary groupname of "myname". This kind of thing makes keeping gids synchronized among multiple applications that much more difficult.

cheeseplus commented 7 years ago

This is a bug in the client, if it's still an issue please open in chef/chef.