From: Andrei Filipovici Date: Wed, 18 Mar 2020 11:25:02 +0000 (+0200) Subject: Changed the fact flush call to make it compatible with Facter 4 X-Git-Tag: v2.3.0~2^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=1d16c99053abee9bf647f5df0f5ea94a662c5b47;p=puppet-modules%2Fpuppetlabs-firewall.git Changed the fact flush call to make it compatible with Facter 4 --- diff --git a/lib/puppet/util/firewall.rb b/lib/puppet/util/firewall.rb index 676bcf8..add4ac0 100644 --- a/lib/puppet/util/firewall.rb +++ b/lib/puppet/util/firewall.rb @@ -180,8 +180,11 @@ module Puppet::Util::Firewall # Older iptables-persistent doesn't provide save action. if os_key == 'Debian' - Facter.fact(:iptables_persistent_version) - persist_ver = Facter.value(:iptables_persistent_version) + # We need to call flush to clear Facter cache as it's possible the cached value will be nil due to the fact + # that the iptables-persistent package was potentially installed after the initial Fact gathering. + fact = Facter.fact(:iptables_persistent_version) + fact.flush if fact.respond_to?(:flush) + persist_ver = fact.value if persist_ver && Puppet::Util::Package.versioncmp(persist_ver, '0.5.0') < 0 os_key = 'Debian_manual' end