Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No users/groups created #462

Open
carlwain74 opened this issue Aug 6, 2021 · 4 comments
Open

No users/groups created #462

carlwain74 opened this issue Aug 6, 2021 · 4 comments

Comments

@carlwain74
Copy link

carlwain74 commented Aug 6, 2021

πŸ—£οΈ 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.

πŸ‘» Brief Description

I am trying to create users from a databag, but nothing is getting created and the recipe seems to process successfully.

πŸ₯ž Cookbook version

8.0.0

πŸ‘©β€πŸ³ Chef-Infra Version

17.3.48

🎩 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

πŸš“ Expected behavior

I would expect all users to get created.

βž• 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' ]
@ramereth
Copy link
Contributor

@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?

@carlwain74
Copy link
Author

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

@ttr
Copy link

ttr commented Nov 24, 2021

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.

@voodoodror
Copy link

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.

Thanks! It worked for me while upgrading from 1.8.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants