mysql_user.rb 599 B

1234567891011121314151617181920212223
  1. # This has to be a separate type to enable collecting
  2. Puppet::Type.newtype(:mysql_user) do
  3. @doc = "Manage a database user."
  4. ensurable
  5. autorequire(:service) { 'mysqld' }
  6. newparam(:name) do
  7. desc "The name of the user. This uses the 'username@hostname' form."
  8. validate do |value|
  9. if value.split('@').first.size > 16
  10. raise ArgumentError,
  11. "MySQL usernames are limited to a maximum of 16 characters"
  12. end
  13. end
  14. end
  15. newproperty(:password_hash) do
  16. desc "The password hash of the user. Use mysql_password() for creating such a hash."
  17. end
  18. end