summaryrefslogtreecommitdiff
path: root/lib/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/functions/mysql_password.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/mysql_password.rb b/lib/puppet/parser/functions/mysql_password.rb
new file mode 100644
index 0000000..6443d95
--- /dev/null
+++ b/lib/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
+