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

proxy_mysql_user + ensure absent #161

Open
bgriffinte opened this issue Jan 26, 2021 · 4 comments
Open

proxy_mysql_user + ensure absent #161

bgriffinte opened this issue Jan 26, 2021 · 4 comments

Comments

@bgriffinte
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet:
  • Ruby:
  • Distribution:
  • Module version:

How to reproduce (e.g Puppet code you use)

I changed a user definition to 'ensure: absent' and started getting errors.

What are you seeing

Line 16 of proxy_mysql_user.rb emitted a Error: Failed to apply catalog: undefined method start_with?' for nil:NilClass` error.

What behaviour did you expect instead

Output log

Any additional information you'd like to impart

I created a bogus password for the deleted user, and then it seemed to work fine.

@alexjfisher
Copy link
Member

Could you run with --trace and post the stack trace?

@bgriffinte
Copy link
Author

...
Error: Failed to apply catalog: undefined method `start_with?' for nil:NilClass
/opt/puppetlabs/puppet/cache/lib/puppet/type/proxy_mysql_user.rb:16:in `initialize'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource.rb:478:in `new'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource.rb:478:in `to_ral'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:639:in `block in to_catalog'
...

That fragment is all I saved before my fix.

@vStone
Copy link

vStone commented Aug 17, 2023

We have the same issue when trying to enable purge.

The issue can also be triggered with puppet resoruce proxy_mysql_user:

Error: Could not run: undefined method `start_with?' for nil:NilClass
/opt/puppetlabs/puppet/cache/lib/puppet/type/proxy_mysql_user.rb:24:in `initialize'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1222:in `new'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1222:in `block (2 levels) in instances'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1209:in `collect'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1209:in `block in instances'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1208:in `collect'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1208:in `instances'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/resource/ral.rb:24:in `search'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:299:in `search'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:243:in `block in find_or_save_resources'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:62:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:297:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:228:in `find_or_save_resources'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:147:in `block in main'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:62:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:297:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:142:in `main'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:390:in `run_command'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:382:in `block in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:734:in `exit_on_fail'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:382:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:143:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:77:in `execute'
/opt/puppetlabs/puppet/bin/puppet:5:in `<main>'

I was able to temporary fix it by replacing the following line in type/proxy_mysql_user.rb

-    self[:password] = "*#{Digest::SHA1.hexdigest(Digest::SHA1.digest(self[:password])).upcase}" unless self[:password].start_with?('*') || self[:encrypt_password] != :true
+    self[:password] = "*#{Digest::SHA1.hexdigest(Digest::SHA1.digest(self[:password])).upcase}" unless self[:password].nil? || self[:password].start_with?('*') || self[:encrypt_password] != :true

@vStone
Copy link

vStone commented Aug 17, 2023

Looks like we have a similar problem with proxy_mysql_query_rule. When trying to list them or enable purging, we run into a nil error on the rule_id.

Error: Could not run: rule_id parameter is required.
/opt/puppetlabs/puppet/cache/lib/puppet/type/proxy_mysql_query_rule.rb:19:in `block (2 levels) in <top (required)>'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:2452:in `initialize'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1222:in `new'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1222:in `block (2 levels) in instances'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1209:in `collect'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1209:in `block in instances'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1208:in `collect'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1208:in `instances'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/resource/ral.rb:24:in `search'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:299:in `search'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:243:in `block in find_or_save_resources'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:62:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:297:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:228:in `find_or_save_resources'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:147:in `block in main'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:62:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:297:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/resource.rb:142:in `main'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:390:in `run_command'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:382:in `block in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:734:in `exit_on_fail'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:382:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:143:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:77:in `execute'
/opt/puppetlabs/puppet/bin/puppet:5:in `<main>'

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

3 participants