add comments
[mirror/dsa-puppet.git] / modules / puppetmaster / lib / puppet / parser / functions / onion_tor_service_hostname.rb
1 # This function returns the .onion name for a given service name on the local host's tor instance
2 module Puppet::Parser::Functions
3   newfunction(:onion_tor_service_hostname, :type => :rvalue) do |args|
4     servicename = args.shift()
5
6     onion_tor_service_hostname_fact = lookupvar('onion_tor_service_hostname')
7
8     require 'json'
9     parsed = JSON.parse(onion_tor_service_hostname_fact)
10     return parsed[servicename]
11   end
12 end
13 # vim:set ts=2:
14 # vim:set et:
15 # vim:set shiftwidth=2: