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

Allow setting password for user without password #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jgorgolewski
Copy link

@jgorgolewski jgorgolewski commented May 8, 2020

If user does not have rep:password code fails with:

Caused by NoMethodError: undefined method `match' for nil:NilClass
/var/chef/cache/cookbooks/cq/libraries/provider_cq_user.rb:246:in `hash_decoder'
/var/chef/cache/cookbooks/cq/libraries/provider_cq_user.rb:268:in `hash_generator'
/var/chef/cache/cookbooks/cq/libraries/provider_cq_user.rb:295:in `password_update?'
/var/chef/cache/cookbooks/cq/libraries/provider_cq_user.rb:70:in `modify_user'

The problem is that ruby evaluates hash_generator(new_pass) before checking if end_with? can be called on nil.

If user does not have rep:password code fails with:
Caused by NoMethodError: undefined method `match' for nil:NilClass
/var/chef/cache/cookbooks/cq/libraries/provider_cq_user.rb:246:in `hash_decoder'
/var/chef/cache/cookbooks/cq/libraries/provider_cq_user.rb:268:in `hash_generator'
/var/chef/cache/cookbooks/cq/libraries/provider_cq_user.rb:295:in `password_update?'
/var/chef/cache/cookbooks/cq/libraries/provider_cq_user.rb:70:in `modify_user'

The problem is that ruby evaluates hash_generator(new_pass) before checking if end_with? can be called on nil.
@jwadolowski
Copy link
Owner

jwadolowski commented May 13, 2020

Hi @jgorgolewski. Thanks for the PR! I'm swamped with work recently, but promise to have a look at that by the end of the week.

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

Successfully merging this pull request may close these issues.

None yet

2 participants