diff options
author | mh <mh@immerda.ch> | 2009-02-21 17:22:47 +0000 |
---|---|---|
committer | mh <mh@immerda.ch> | 2009-02-21 17:22:47 +0000 |
commit | 288a33be75de3d6e75d6039bd92dcfda46fda190 (patch) | |
tree | ef36965c38daa0b7cd7e89fc5aea6e1130572416 /plugins/puppet | |
parent | 2dc631bd2a441644090ae9075135db8e977ff03e (diff) |
merged with puzzle
Diffstat (limited to 'plugins/puppet')
-rw-r--r-- | plugins/puppet/type/mysql_user.rb | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/plugins/puppet/type/mysql_user.rb b/plugins/puppet/type/mysql_user.rb index d92b610..55d97b6 100644 --- a/plugins/puppet/type/mysql_user.rb +++ b/plugins/puppet/type/mysql_user.rb @@ -1,12 +1,22 @@ # This has to be a separate type to enable collecting Puppet::Type.newtype(:mysql_user) do - @doc = "Manage a database user." - ensurable - newparam(:name) do - desc "The name of the user. This uses the 'username@hostname' form." - end - newproperty(:password_hash) do - desc "The password hash of the user. Use mysql_password() for creating such a hash." - end + @doc = "Manage a database user." + ensurable + newparam(:name) do + desc "The name of the user. This uses the 'username@hostname' form." + + validate do |value| + if value.split('@').first.size > 16 + raise ArgumentError, + "MySQL usernames are limited to a maximum of 16 characters" + else + super + end + end + end + + newproperty(:password_hash) do + desc "The password hash of the user. Use mysql_password() for creating such a hash." + end end |