Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Group resource errors with duplicate user names #9119
I recently encountered some unexpected behavior with a cookbook that manages group membership for some of my hosts. It might be a good idea to do some input validation to remove duplicate entries and protect users from themselves.
Describe the problem
When passing a list of users to add to a group, if there are any duplicates in the list, Chef encounters a Windows 1378 error. (User already in group)
OS: Windows 2019, Windows 2016
default['group_manager'] << 'contoso\testuser'
Chef run failure caused by duplicate users``` ================================================================================ Error executing action `create` on resource 'group[Administrators]' ================================================================================
To fix my users, I simply added a ".uniq" to the array being passed to the members property.
Something similar might be added as input validation on the resource side.