From 446798cbcb677dc70ab1cb2eaaf42cbe73a1a3db Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 30 Jul 2016 14:56:55 +0200 Subject: [PATCH] handle fact not yet existing --- .../puppet/parser/functions/onion_balance_service_hostname.rb | 1 + .../lib/puppet/parser/functions/onion_tor_service_hostname.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/puppetmaster/lib/puppet/parser/functions/onion_balance_service_hostname.rb b/modules/puppetmaster/lib/puppet/parser/functions/onion_balance_service_hostname.rb index be2d1cb2e..8a4a9f41b 100644 --- a/modules/puppetmaster/lib/puppet/parser/functions/onion_balance_service_hostname.rb +++ b/modules/puppetmaster/lib/puppet/parser/functions/onion_balance_service_hostname.rb @@ -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) 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 index 9635dbabc..ca642da43 100644 --- a/modules/puppetmaster/lib/puppet/parser/functions/onion_tor_service_hostname.rb +++ b/modules/puppetmaster/lib/puppet/parser/functions/onion_tor_service_hostname.rb @@ -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) -- 2.20.1