1 # This function returns the .onion name for a given service name on the local host's onionbalance instance
2 module Puppet::Parser::Functions
3 newfunction(:onion_balance_service_hostname, :type => :rvalue) do |args|
4 servicename = args.shift()
6 onion_balance_service_hostname_fact = lookupvar('onion_balance_service_hostname')
7 return nil if onion_balance_service_hostname_fact.nil?
10 parsed = JSON.parse(onion_balance_service_hostname_fact)
11 return parsed[servicename]
16 # vim:set shiftwidth=2: