rename onion facts
[mirror/dsa-puppet.git] / modules / puppetmaster / lib / puppet / parser / functions / onion_tor_service_hostname.rb
diff --git a/modules/puppetmaster/lib/puppet/parser/functions/onion_tor_service_hostname.rb b/modules/puppetmaster/lib/puppet/parser/functions/onion_tor_service_hostname.rb
new file mode 100644 (file)
index 0000000..4d17eb2
--- /dev/null
@@ -0,0 +1,14 @@
+module Puppet::Parser::Functions
+  newfunction(:onion_tor_service_hostname, :type => :rvalue) do |args|
+    servicename = args.shift()
+
+    onion_tor_service_hostname_fact = lookupvar('onion_tor_service_hostname')
+
+    require 'json'
+    parsed = JSON.parse(onion_tor_service_hostname_fact)
+    return parsed[servicename]
+  end
+end
+# vim:set ts=2:
+# vim:set et:
+# vim:set shiftwidth=2: