users
users copied to clipboard
No users/groups created
:speaking_head: Foreword
Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.
:ghost: Brief Description
I am trying to create users from a databag, but nothing is getting created and the recipe seems to process successfully.
:pancakes: Cookbook version
8.0.0
:woman_cook: Chef-Infra Version
17.3.48
:tophat: Platform details
AWS EC2: Amazon Linux 2 (latest)
Steps To Reproduce
Setup my recipe to include the example
Get the users from the data bag
users_from_databag = search('users', 'groups:users OR groups:op')
if node["authorization"]["groups"]
node["authorization"]["groups"].each do |group|
next unless group
users_manage group do
action [ :create ]
end
users_manage group do
action [ :remove ]
end
end
end
users_manage 'sysadmin' do
group_id 2300
action [:create]
users users_from_databag
end
:police_car: Expected behavior
I would expect all users to get created.
:heavy_plus_sign: Additional context
The output of the search command returns an array of this type
data_bag_item["users", "atrbojevic", {"id"=>"atrbojevic", "shell"=>"/bin/bash", "ssh_keys"=>["<<PRIVATE_KEY_STRING>> *******@realnetworks.com"], "groups"=>["users"]}]
Attribute: default['authorization']['groups'] = [ 'users','ops' ]
@carlwain74 we've made various changes in the cookbook since you posted this. Can you please confirm this is still happens with the latest version?
I updated to 8.1.0 and still see the same issue. The recipe is executed, but no updates to /etc/passwd or /etc/group
Had very similar issue and got fixed by adding
users users_from_databag
to all users_manage
blocks
My feeling is that Your two users_manage blocks are passing with no change as they do not have any users passed in them.