Skip to content

Allow setting password for user without password#80

Open
jgorgolewski wants to merge 1 commit into
jwadolowski:masterfrom
jgorgolewski:patch-1
Open

Allow setting password for user without password#80
jgorgolewski wants to merge 1 commit into
jwadolowski:masterfrom
jgorgolewski:patch-1

Conversation

@jgorgolewski

@jgorgolewski jgorgolewski commented May 8, 2020

Copy link
Copy Markdown

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

jwadolowski commented May 13, 2020

Copy link
Copy Markdown
Owner

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.

2 participants