-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
I'm getting an error when using chef_user resource after a second user is created. It then starts failing for the first one, saying it already exists. So it's trying to add the existing user. Digging in, i think I've found the issue
chef-users seems to get saved in run-state as things like this:
node.run_state['chef-users'] = "delivery\n"
node.run_state['chef-users'] = "\n"
node.run_state['chef-users'] = "delivery\nsomeother\n"
node.run_state['chef-users'] = "someother\ndelivery\n"The current guard for that is:
not_if { node.run_state['chef-users'].index(/^#{new_resource.username}$/) }This doesn't seem right, as the code produces the following results:
# comment shows return
node.run_state['chef-users'] = "delivery\n" # 0
node.run_state['chef-users'] = "\n" # nil
node.run_state['chef-users'] = "delivery\nsomeother\n" # 0
node.run_state['chef-users'] = "someother\ndelivery\n" # 10I suspect this isn't what we want?
Created a fix commit here: https://github.com/patcon/chef_stack/commits/blendive/develop
Let me know if you recognize this as an issue, and happy to create a PR
cc: @mrjcleaver
Metadata
Metadata
Assignees
Labels
No labels