handle fact not yet existing
authorPeter Palfrader <peter@palfrader.org>
Sat, 30 Jul 2016 12:56:55 +0000 (14:56 +0200)
committerPeter Palfrader <peter@palfrader.org>
Sat, 30 Jul 2016 12:56:55 +0000 (14:56 +0200)
modules/puppetmaster/lib/puppet/parser/functions/onion_balance_service_hostname.rb
modules/puppetmaster/lib/puppet/parser/functions/onion_tor_service_hostname.rb

index be2d1cb..8a4a9f4 100644 (file)
@@ -4,6 +4,7 @@ module Puppet::Parser::Functions
     servicename = args.shift()
 
     onion_balance_service_hostname_fact = lookupvar('onion_balance_service_hostname')
+    return nil if onion_balance_service_hostname_fact.nil?
 
     require 'json'
     parsed = JSON.parse(onion_balance_service_hostname_fact)
index 9635dba..ca642da 100644 (file)
@@ -4,6 +4,7 @@ module Puppet::Parser::Functions
     servicename = args.shift()
 
     onion_tor_service_hostname_fact = lookupvar('onion_tor_service_hostname')
+    return nil if onion_tor_service_hostname_fact.nil?
 
     require 'json'
     parsed = JSON.parse(onion_tor_service_hostname_fact)