From: Peter Palfrader Date: Sat, 30 Jul 2016 12:56:55 +0000 (+0200) Subject: handle fact not yet existing X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=446798cbcb677dc70ab1cb2eaaf42cbe73a1a3db;p=mirror%2Fdsa-puppet.git handle fact not yet existing --- 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)