summaryrefslogtreecommitdiff
path: root/plugins/puppet
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2009-02-21 17:22:47 +0000
committermh <mh@immerda.ch>2009-02-21 17:22:47 +0000
commit288a33be75de3d6e75d6039bd92dcfda46fda190 (patch)
treeef36965c38daa0b7cd7e89fc5aea6e1130572416 /plugins/puppet
parent2dc631bd2a441644090ae9075135db8e977ff03e (diff)
merged with puzzle
Diffstat (limited to 'plugins/puppet')
-rw-r--r--plugins/puppet/type/mysql_user.rb26
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