diff options
Diffstat (limited to 'lib/puppet/type/mysql_user.rb')
-rw-r--r-- | lib/puppet/type/mysql_user.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/puppet/type/mysql_user.rb b/lib/puppet/type/mysql_user.rb new file mode 100644 index 0000000..55d97b6 --- /dev/null +++ b/lib/puppet/type/mysql_user.rb @@ -0,0 +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." + + 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 + |