summaryrefslogtreecommitdiff
path: root/plugins/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/puppet/parser')
-rw-r--r--plugins/puppet/parser/functions/mysql_password.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/puppet/parser/functions/mysql_password.rb b/plugins/puppet/parser/functions/mysql_password.rb
new file mode 100644
index 0000000..6443d95
--- /dev/null
+++ b/plugins/puppet/parser/functions/mysql_password.rb
@@ -0,0 +1,9 @@
+# hash a string as mysql's "PASSWORD()" function would do it
+require 'digest/sha1'
+
+module Puppet::Parser::Functions
+ newfunction(:mysql_password, :type => :rvalue) do |args|
+ '*' + Digest::SHA1.hexdigest(Digest::SHA1.digest(args[0])).upcase
+ end
+end
+