lib/simp/rspec-puppet-facts.rb in simp-rspec-puppet-facts-3.2.0 vs lib/simp/rspec-puppet-facts.rb in simp-rspec-puppet-facts-3.3.0
- old
+ new
@@ -71,13 +71,13 @@
facts.merge! lsb_facts( facts )
facts.merge! selinux_facts( opts[:selinux_mode], facts )
facts.merge! opts.fetch( :extra_facts_immutable, {} )
end
- if ( ENV.fetch('SIMP_FACTS_OS',nil) &&
- !ENV['SIMP_FACTS_OS'].strip.empty? &&
+ if ( ENV['SIMP_FACTS_OS'] &&
+ !ENV['SIMP_FACTS_OS'].to_s.strip.empty? &&
ENV['SIMP_FACTS_OS'] !~ /all/i )
- unless ENV['SIMP_FACTS_OS'].strip.split(/[ ,]+/).include? os
+ unless ENV['SIMP_FACTS_OS'].strip.split(/[ ,]+/).any?{|str| os == str || os.match?(%r[#{str}]) }
h.delete(os)
end
end
end